All Problems

Problem title

Difficulty

Avg time to solve

Sort 0 1

Moderate

--

Insertion in a Priority queue -Max Heap

Easy

20 mins

Min Heap

Moderate

30 mins

Remove Loop

Moderate

--

Reverse String

Moderate

--

Remove character

Easy

--

Most Frequent Element

Easy

--

Get Maximum in Generated Array

Easy

--

Maximum Consecutive Ones

Easy

--

Preorder Traversal

Easy

--

Problem

Submissions

1

Avg. time to solve

30 min

Success Rate

60%

Problem Statement

```
0 X
Insert X in the heap.
1
Print the minimum element from the heap and remove it.
```

```
The first line will contain the integer 'T', denoting the number of test cases.
For each test case, the first line will contain a single integer 'N', the number of queries.
Then each of the next ‘N’ lines contains two types of query either 0 ‘X’ or 1.
```

```
For each test case, output the query of type 1 on new line..
```

```
You don't need to print anything. It has already been taken care of. Just implement the given function.
```

```
1 <= T <= 5
1 <= N <= 10^5
1 <= X <= 50
Time Limit: 1 sec
```

```
2
3
0 2
0 1
1
2
0 1
1
```

```
1
1
```

```
For the first test case:-
Insert 2 in the heap and currently, 2 is the smallest element in the heap.
Insert 1 in the heap and now the smallest element is 1.
Return and remove the smallest element which is 1.
For the second test case:-
Insert 1 in the heap and currently, 1 is the smallest element in the heap.
Return the smallest element from the heap which is 1 and remove it.
```

```
2
5
0 5
1
0 43
0 15
0 5
2
0 4
1
```

```
5
4
```

Python (3.5)

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Theme

Solution submission not allowed

Save Code

Reset Code