Skip to content
BytePatterns

Stacks & Queues

Two humble rules, LIFO and FIFO, doing surprisingly heavy lifting.

Stacks & Queues progress0 / 9
  1. Stack BasicsLast one in is the first one out.4m
  2. Valid ParenthesesA closing bracket must answer the newest opening one.5m
  3. Queue BasicsFirst one in is the first one out.4m
  4. Queue From Two StacksReverse a reversal and LIFO turns into FIFO.5m
  5. Monotonic StackKeep the stack ordered and every item waits only once.6m
  6. Min StackCarry the answer up with the data instead of recomputing it.5m
  7. Sliding Window MaximumA queue that drops anyone it has already outgrown.6m
  8. Circular QueueA fixed array that never shifts, because the ends wrap around.5m
  9. Largest RectangleEvery bar waits on the stack until both its walls are known.7m

Quiz yourself: 3 questions from this module

1 / 3

Which item does pop() remove from a stack?