Top Company Stacks, Heaps, Intervals, and Linked Lists Python practice problems
Practice cache design, monotonic structures, heaps, intervals, and advanced linked-list patterns.
Core concepts
Problem-solving patterns
- Maintain only the candidates that can still affect the answer
Reported company tags
All 20 problems in this topic
Work from top to bottom to build the concept gradually.
- #281Merge k sorted lists: Three sorted feedsCompany HardPremium
Merge three sorted integer feeds into one ordered stream.
- #282Merge k sorted lists: Single sourceCompany HardPremium
With one source, the heap returns the original sorted sequence.
- #283Add numbers stored in linked lists: Different three-digit numbersCompany MediumPremium
Add two numbers whose digits are stored least-significant first.
- #284Add numbers stored in linked lists: Carry creates a new digitCompany MediumPremium
Continue after both lists end when a final carry remains.
- #285Copy a random-pointer list: Mixed random linksCompany HardPremium
Deep-copy a list whose random pointers target several nodes.
- #286Copy a random-pointer list: No random linksCompany HardPremium
Copy a list where every random pointer is None.
- #287Reorder a linked list: Even-length chainCompany MediumPremium
Reorder nodes as first, last, second, second-last, and so on.
- #288Reorder a linked list: Odd-length chainCompany MediumPremium
Leave the middle node for the final position in an odd-length list.
- #289Implement an LRU cache: Evict old entriesCompany HardPremium
Process cache operations and evict the least recently used key at capacity.
- #290Implement an LRU cache: Refresh an existing keyCompany HardPremium
Updating an existing key also makes it most recently used.
- #291Implement a minimum stack: Track changing minimumsCompany MediumPremium
Return the current minimum as values are pushed and removed.
- #292Implement a minimum stack: Duplicate minimumCompany MediumPremium
Keep the correct minimum when one of two equal minimum values is popped.
- #293Find warmer-day waits: Mixed forecastCompany MediumPremium
For each day, count how long until a warmer temperature appears.
- #294Find warmer-day waits: Never warmerCompany MediumPremium
All waits are zero when temperatures only decrease.
- #295Find the largest histogram rectangle: Classic histogramCompany HardPremium
Find the maximum rectangle area in a varied histogram.
- #296Find the largest histogram rectangle: Uniform barsCompany HardPremium
Use the full width when every bar has the same height.
- #297Find sliding-window maximums: Overlapping windowsCompany HardPremium
Return the maximum from every width-three sliding window.
- #298Find sliding-window maximums: Window of oneCompany HardPremium
A window of one returns every original value.
- #299Count required meeting rooms: Overlapping meetingsCompany MediumPremium
Find how many rooms are needed so no meeting is delayed.
- #300Count required meeting rooms: Back-to-back meetingsCompany MediumPremium
Reuse one room when each meeting ends as the next begins.