Data Structures & Algorithms
Complete catalog of 99 interactive algorithm visualizers. Browse by data structure category or filter by difficulty.
Simulate asteroid collisions where positive asteroids move right and negative move left. Smaller asteroids explode upon impact.
Keep score for a baseball game by processing score records, invalidations, doubling, and additions using a stack.
Calculate the number of car fleets that will arrive at the target destination using arrival times and a monotonic stack.
Find the number of days you have to wait after the i-th day to get a warmer temperature using a monotonic decreasing stack.
Evaluate arithmetic expressions written in Reverse Polish Notation (postfix) using a LIFO operand stack.
Design a stack supporting push, pop, top, and retrieving the minimum element in constant O(1) time using an auxiliary monotonic min-tracker stack.
Find the next greater element for each number in nums1 within nums2 using a monotonic stack and hash map.
Find the next greater numeric element for every number in a circular integer array using a monotonic decreasing stack over two passes.
Calculate the span of stock prices in an online stream using a monotonic decreasing stack tracking [price, span] pairs.
Repeatedly remove adjacent, duplicate character pairs from a string using a LIFO stack until no duplicates remain.
Convert an absolute Unix-style file path into its canonical simplified form using a LIFO stack to manage directory navigation, parent traversals, and redundant slashes.
Determine if an input string containing '(', ')', '{', '}', '[' and ']' is valid using a LIFO stack.
