practice a little every day — you've got this ♡
Stacks & Queues Interview Problems
Practice 5969 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.
- 5969
- Problems
- 2211
- Auto-graded
- 15
- Topics
- 272
- Added today
Showing 31–60 of 93 results
- Stacks & QueuesMediumAuto-gradedExpand Nested Repeat Notation in a Compressed String
Parse a string with nested count-and-bracket repeat markers and expand it fully, testing recursive or stack-based parsing and careful handling of multi-digit counts.
Stacks & Queuesstringsstackrecursionparsing - Stacks & QueuesMediumAuto-gradedLongest Well-Formed Bracket Run
Find the length of the longest contiguous well-formed stretch in a string of only round brackets, testing stack-based index tracking and handling of unmatched characters.
Stacks & Queuesstackstringparenthesestwo-pass - Stacks & QueuesMediumAuto-gradedUnscramble a Cipher-Encoded Nested Outline
Parse a parenthesized pre-order tree string with a stack and undo a letter-substitution cipher, where each node's text is the run just before its closing parenthesis.
Stacks & Queuesstackstring-parsingtree-deserializationsubstitution-cipher - Stacks & QueuesEasyAuto-gradedStack Simulator with Constant-Time Minimum Queries
Simulate a sequence of stack commands and answer minimum queries in constant time by tracking the running minimum alongside each element.
Stacks & Queuesstackdesignsimulationauxiliary-stack - Stacks & QueuesEasyAuto-gradedCalculate Rolling Means from a Data Stream
Evaluate tracking a sliding window over incoming numbers to incrementally update and output moving averages.
Stacks & Queuessliding-windowqueuedequearray - Stacks & QueuesMediumAuto-gradedRounds of Pruning in a Garden Row
Count how many rounds of simultaneous removals occur in a row of numbers where each element larger than its left neighbor is removed, using a monotonic stack to beat quadratic simulation.
Stacks & Queuesmonotonic-stacksimulationarraysamortized-analysis - Stacks & QueuesMediumAuto-gradedWidest Span Between Two Dominating Ends
Find the longest subarray whose two end values are each strictly larger than everything between them, using a monotonic stack to avoid checking all pairs.
Stacks & Queuesmonotonic-stackarraysnearest-greateramortized-analysis - Stacks & QueuesMediumAuto-gradedRebuild Call Start/Stop Events from Stack Snapshots
Diff consecutive call-stack snapshots by longest common prefix to produce correctly ordered start and end events, including recursion, empty stacks and final closing.
Stacks & Queuesstacksimulationlongest-common-prefixarrays - Stacks & QueuesMediumAuto-gradedEager Deletion of Repeated Character Blocks
Scan a string and delete each block of k equal adjacent characters as soon as it forms, handling cascading merges with a run-length stack.
Stacks & Queuesstackstringrun-lengthsimulation - Stacks & QueuesMediumAuto-gradedEvaluate Nested Prefix Expressions with Scoped Bindings
Parse and evaluate a parenthesized prefix language with sum, prod and set, handling lexical scoping, strict validation and 32-bit overflow rules.
Stacks & Queuesparsingrecursionscopingstack - Stacks & QueuesMediumAuto-gradedFinish Times for a Single Worker with a Limited Waiting Line
Simulate a one-worker FIFO queue with a capped waiting line and report each job's finish time or -1 if it was rejected, using a deque of finish times.
Stacks & Queuesqueuedequesimulationamortized-analysis - Stacks & QueuesMediumAuto-gradedSelf-Time Accounting for Nested Call Traces
Use a stack to turn start/end trace records of nested calls on one CPU into each function's self-time, with inclusive end timestamps.
Stacks & Queuesstackparsingsimulationstrings - Stacks & QueuesMediumAuto-gradedCheckout Totals After Next Cheaper Coupon Item
Find, for each element, the nearest later value that is less than or equal to it and subtract it, which tests monotonic stack reasoning on arrays.
Stacks & Queuesmonotonic-stackarraysnext-smaller-element - Stacks & QueuesMediumAuto-gradedLargest Block Under a Skyline of Columns
Compute the largest rectangle that fits under a row of unit-width columns, testing monotonic stack usage and boundary reasoning over contiguous ranges.
Stacks & Queuesmonotonic-stackarrayhistogramcontiguous-range - Stacks & QueuesMediumAuto-gradedRebuild an Outline Tree from Depth-Tagged Lines
Turn a flat sequence of (depth, label) entries into a nested tree by attaching each entry to its nearest earlier entry with a smaller depth, using a monotonic stack.
Stacks & Queuesstacktree-constructionparsingmonotonic-stack - Stacks & QueuesMediumAuto-gradedUnnest Deeply Nested Lists Without Recursion
Flatten an arbitrarily nested Python list into a single list in left-to-right order, treating only lists as containers and handling very deep nesting safely.
Stacks & Queuesstackiterationnested-listsdepth-first-search - Stacks & QueuesMediumAuto-gradedValidate Balanced Round, Square and Curly Brackets
Decide whether a string of three bracket kinds is balanced, testing last-in-first-out matching with a stack and handling crossings and leftover or stray brackets.
Stacks & Queuesstackstringsparsingbracket-matching - Stacks & QueuesEasyAuto-gradedNested Delimiter Checker for Config Expressions
Checks whether a string of mixed parentheses, braces, and square brackets is properly nested, testing stack-based matching and early rejection in linear time.
Stacks & Queuesstackparsingstringmatching - Stacks & QueuesHardAuto-gradedReconstruct Function Lifetimes from Periodic Stack Snapshots
Tests ability to diff consecutive call-stack snapshots using longest-common-prefix analysis and stack unwinding to produce ordered START/END lifecycle events.
Stacks & Queuesstacksimulationtwo-pointers - Stacks & QueuesHardAuto-gradedPeak Values in Fixed-Length Subarrays
Tests understanding of monotonic deques to efficiently track the largest element across consecutive fixed-size subarrays in linear time.
Stacks & Queuesdequesliding-windowmonotonic-queue - Stacks & QueuesEasyAuto-gradedBalanced Delimiter Validation with a Stack
Decide whether a bracket-only string is properly nested and matched, using a LIFO stack of pending openers.
Stacks & Queuesstackstringsparsing - Stacks & QueuesHardAuto-gradedSimulate a FIFO Queue with Two Stacks
Tests whether you can emulate first-in-first-out ordering using only two LIFO stacks and explain the amortized cost of each operation.
Stacks & Queuesstacksqueueamortized-analysis - Stacks & QueuesMediumAuto-gradedSingle-Threaded CPU: Exclusive Runtimes and Stack Snapshot
Tests stack simulation and interval reasoning by computing per-function exclusive execution time and reconstructing the active call stack at a query timestamp from a sorted event log.
Stacks & Queuesstacksimulationinterval-reasoning - Stacks & QueuesMediumAuto-gradedBracket Nesting Check and Rotating Cipher
Tests stack-based bracket validation and modular arithmetic to rotate lowercase letters circularly across the alphabet.
Stacks & Queuesstacksstringsmodular-arithmetic - Stacks & QueuesMediumAuto-gradedCalculate Arithmetic Expression with Negation and Grouping
Tests building an operator-precedence parser using stacks to handle binary operations, unary negation, parentheses, and zero-truncating division.
Stacks & Queuesstacksparsingoperator-precedencestring-processing - Stacks & QueuesMediumAuto-gradedCascade Removal of Equal Neighbor Groups
Tests stack-based simulation of iterative removals that trigger chain reactions when fragments recombine.
Stacks & Queuesstackstringsimulation - Stacks & QueuesMediumAuto-gradedSkyline Visible Buildings Count
Tests ability to use a monotonic stack to count, for each building, how many previous buildings are visible looking back from it along a city skyline.
Stacks & Queuesmonotonic stackarrayssimulation - Stacks & QueuesMediumAuto-gradedBracket Matching, Interval Union, and Expression Parsing
Tests stack-based bracket validation, interval merging with endpoint semantics, and arithmetic evaluation with unary operators.
Stacks & Queuesstacksintervalsparsingexpression-evaluation - Stacks & QueuesMediumAuto-gradedTrim a Bracket String to Its Longest Balanced Form
Tests stack-based bracket matching: find and remove the fewest characters from a parentheses-only string to leave a fully balanced result.
Stacks & Queuesstacksstringsgreedy - Stacks & QueuesMediumAuto-gradedIdentify Invalid Parentheses for Removal
Tests stack-based matching to find the minimum set of parenthesis indices that must be removed to balance a string.
Stacks & Queuesstackstring-processinggreedy