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

Core Data Structures: Stacks, Queues, Linked Lists, Heaps, and Intervals Python lessons

Choosing structures by operations, monotonic reasoning, priority queues, and interval processing.

15 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL LEARN

Core concepts

Validate brackets with a stackImplement a queue with two stacksReverse a linked listFind the middle linked-list nodeDetect a linked-list cycleMerge k sorted listsAdd numbers stored in linked listsCopy a random-pointer list
REUSABLE THINKING

Problem-solving patterns

  • stack · common interview
  • queue · two stacks
  • linked list · pointers
  • fast slow pointers · linked list
  • Floyd cycle · linked list
LESSON OUTCOME

What this topic builds

Learn the idea once, trace it through two verified cases, then explain why your approach works.

ORDERED LESSONS

All 15 lessons in this topic

Work from top to bottom to build each concept gradually.

  1. #122
    Validate brackets with a stack

    Validate a correctly nested sequence of three bracket types.

    BeginnerPremium
  2. #123
    Implement a queue with two stacks

    Process enqueues, a peek, and removals in first-in-first-out order.

    IntermediatePremium
  3. #124
    Reverse a linked list

    Reverse the links in a five-node chain.

    IntermediatePremium
  4. #125
    Find the middle linked-list node

    Return the central node from an odd number of nodes.

    IntermediatePremium
  5. #126
    Detect a linked-list cycle

    Detect a tail that points back to an earlier node.

    AdvancedPremium
  6. #127
    Merge k sorted lists

    Merge three sorted integer feeds into one ordered stream.

    AdvancedPremium
  7. #128
    Add numbers stored in linked lists

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

    AdvancedPremium
  8. #129
    Copy a random-pointer list

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

    Interview-LevelPremium
  9. #130
    Reorder a linked list

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

    Interview-LevelPremium
  10. #131
    Implement an LRU cache

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

    Interview-LevelPremium
  11. #132
    Implement a minimum stack

    Return the current minimum as values are pushed and removed.

    Interview-LevelPremium
  12. #133
    Find warmer-day waits

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

    Interview-LevelPremium
  13. #134
    Find the largest histogram rectangle

    Find the maximum rectangle area in a varied histogram.

    Interview-LevelPremium
  14. #135
    Find sliding-window maximums

    Return the maximum from every width-three sliding window.

    Interview-LevelPremium
  15. #136
    Count required meeting rooms

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

    Interview-LevelPremium