Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a Min-Heap with insertion, deletion, and heapify operations using a slice.

Hard

Problem Statement

Implement a Min-Heap with insertion, deletion, and heapify operations using a slice.

Sample Input

Insert(5); Insert(3); GetMin()

Sample Output

3

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
package main import "fmt" type MinHeap struct { // Your code here } func main() { heap := &MinHeap{} heap.Insert(5) heap.Insert(3) heap.Insert(8) heap.Insert(1) fmt.Println(heap.ExtractMin()) // Expected Output: 1 fmt.Println(heap.ExtractMin()) // Expected Output: 3 }
Log in or sign up to run or submit your code.Log inSign up
Input
Insert(5); Insert(3); GetMin()
Expected Output
3