pyPython Practice LabFrom first print to final round
TOPIC 15 OF 18

Top Company Stacks, Heaps, Intervals, and Linked Lists Python practice problems

Practice cache design, monotonic structures, heaps, intervals, and advanced linked-list patterns.

20 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL PRACTISE

Core concepts

Merge k sorted listsAdd numbers stored in linked listsCopy a random-pointer listReorder a linked listImplement an LRU cacheImplement a minimum stackFind warmer-day waitsFind the largest histogram rectangle
REUSABLE THINKING

Problem-solving patterns

  • Maintain only the candidates that can still affect the answer
INTERVIEW SIGNALS

Reported company tags

AmazonGoogleMetaMicrosoftBloomberg
Community-reported tags are guidance, not guarantees.
ORDERED PRACTICE

All 20 problems in this topic

Work from top to bottom to build the concept gradually.

  1. #281
    Merge k sorted lists: Three sorted feeds

    Merge three sorted integer feeds into one ordered stream.

    Company HardPremium
  2. #282
    Merge k sorted lists: Single source

    With one source, the heap returns the original sorted sequence.

    Company HardPremium
  3. #283
    Add numbers stored in linked lists: Different three-digit numbers

    Add two numbers whose digits are stored least-significant first.

    Company MediumPremium
  4. #284
    Add numbers stored in linked lists: Carry creates a new digit

    Continue after both lists end when a final carry remains.

    Company MediumPremium
  5. #285
    Copy a random-pointer list: Mixed random links

    Deep-copy a list whose random pointers target several nodes.

    Company HardPremium
  6. #286
    Copy a random-pointer list: No random links

    Copy a list where every random pointer is None.

    Company HardPremium
  7. #287
    Reorder a linked list: Even-length chain

    Reorder nodes as first, last, second, second-last, and so on.

    Company MediumPremium
  8. #288
    Reorder a linked list: Odd-length chain

    Leave the middle node for the final position in an odd-length list.

    Company MediumPremium
  9. #289
    Implement an LRU cache: Evict old entries

    Process cache operations and evict the least recently used key at capacity.

    Company HardPremium
  10. #290
    Implement an LRU cache: Refresh an existing key

    Updating an existing key also makes it most recently used.

    Company HardPremium
  11. #291
    Implement a minimum stack: Track changing minimums

    Return the current minimum as values are pushed and removed.

    Company MediumPremium
  12. #292
    Implement a minimum stack: Duplicate minimum

    Keep the correct minimum when one of two equal minimum values is popped.

    Company MediumPremium
  13. #293
    Find warmer-day waits: Mixed forecast

    For each day, count how long until a warmer temperature appears.

    Company MediumPremium
  14. #294
    Find warmer-day waits: Never warmer

    All waits are zero when temperatures only decrease.

    Company MediumPremium
  15. #295
    Find the largest histogram rectangle: Classic histogram

    Find the maximum rectangle area in a varied histogram.

    Company HardPremium
  16. #296
    Find the largest histogram rectangle: Uniform bars

    Use the full width when every bar has the same height.

    Company HardPremium
  17. #297
    Find sliding-window maximums: Overlapping windows

    Return the maximum from every width-three sliding window.

    Company HardPremium
  18. #298
    Find sliding-window maximums: Window of one

    A window of one returns every original value.

    Company HardPremium
  19. #299
    Count required meeting rooms: Overlapping meetings

    Find how many rooms are needed so no meeting is delayed.

    Company MediumPremium
  20. #300
    Count required meeting rooms: Back-to-back meetings

    Reuse one room when each meeting ends as the next begins.

    Company MediumPremium