Stacks and Queues Visualizers

12

Step through every Stacks and Queues problem with animated runtime state, source highlighting, and curated test cases. Built for coding-interview prep and durable algorithmic intuition.

Car Fleet
Determine how many fleets of cars will arrive at a destination by tracking time-to-target using a monotonic stack.
Monotonic Stack
Daily Temperatures
Sweep from right to left with a monotonic stack of warmer indices waiting to help earlier days.
Monotonic Stack
Evaluate Reverse Polish Notation
Numbers go onto the stack; each operator pops the last two values, computes, and pushes the result back.
Evaluation Stack
Implement Queue using Stacks
Use one stack for incoming pushes and another for outgoing pops, transferring only when needed.
Two Stacks
Implement Stack using Queues
Push to the queue, then rotate older elements behind the new one so the front behaves like stack top.
Queue Rotation
Largest Rectangle in Histogram
Find the maximum rectangular area spanning adjacent bars by tracking height boundaries with a monotonic increasing stack.
Monotonic Stack
Min Stack
Store each pushed value together with the minimum seen so far so min() stays O(1).
Augmented Stack
Next Greater Element I
Scan nums2 right-to-left with a decreasing stack, seeding each value's next greater into a hash-map, then answer nums1 queries in O(1).
Monotonic Stack Mapping
Next Greater Element II
Simulate a circular array by scanning twice while the monotonic stack keeps candidate greater values.
Circular Monotonic Stack
Remove Outermost Parentheses
Track primitive depth and emit only the characters that are not on the outermost shell.
Depth Counting
Rotting Oranges
Run BFS level by level from every rotten orange so each minute spreads rot to fresh neighbors.
Queue BFS
Valid Parentheses
Push opening brackets and match them off in reverse order whenever a closing bracket arrives.
Bracket Stack