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.
NeetCodeIO
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.
---
Idk about you guys, but with the muscle memory I built up, this change might take some getting used to 😅
2 weeks ago | [YT] | 537