Before this, we had to negate values when pushing and popping from a heap, as a workaround to simulate a max heap (using a min heap).
Idk why this took so long, but it's a pleasant surprise. And frankly, it's another reason why Python is the obvious choice for readability in coding interviews.
NeetCode
Python finally supports native max heap operations!
Python 3.14 added the following methods to the heapq module:
- heapify_max()
- heappush_max()
- heappop_max()
- heapreplace_max()
- heappushpop_max()
Before this, we had to negate values when pushing and popping from a heap, as a workaround to simulate a max heap (using a min heap).
Idk why this took so long, but it's a pleasant surprise. And frankly, it's another reason why Python is the obvious choice for readability in coding interviews.
We also added Python 3.14 support to neetcode.io/
If you're still not using Python, what is you doing.
1 month ago | [YT] | 1,220