Skip to content
CodeItRaw
Code Reading
/
Pop the Smallest
Path
Play
Daily
Leaderboard
tr
Predict the Output
Pop the Smallest
heapq always hands out the smallest first. What is printed?
1
import
heapq
2
3
h = [
5
,
1
,
8
,
3
]
4
heapq.heapify(h)
5
heapq.heappush(h,
2
)
6
print
(heapq.heappop(h), heapq.heappop(h),
len
(h))