practice a little every day — you've got this ♡
Stacks & Queues Interview Problems
Practice 5967 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.
- 5967
- Problems
- 2210
- Auto-graded
- 15
- Topics
- 272
- Added today
Showing 1–30 of 93 results
- Stacks & QueuesEasyAuto-gradedTyped Value Stack Interpreter with Mixed Addition
Simulate a stack machine whose values are tagged ints or strings, where ADD sums two ints or concatenates otherwise, and return the printed lines.
Stacks & Queuesstacksimulationstringstagged-union - Stacks & QueuesMediumAuto-gradedFixed-Width Window Folds with Add, Multiply, or AND
Compute the fold of every length-k window of an array under a named associative operation, ideally in linear time without relying on inverse operations.
Stacks & Queuessliding-windowtwo-stacksassociative-operationqueue - Stacks & QueuesMediumAuto-gradedCollapse Adjacent Edits Before Applying Them to a Text Buffer
Simulate a queue of insert and format edits, merging adjacent inserts and dropping repeated adjacent formats, then return the final text and ordered list of applied styles.
Stacks & Queuesstacksimulationcommand-patternstrings - Stacks & QueuesMediumAuto-gradedNormalize a Filesystem Location String
Reduce an absolute Unix-style path to its canonical form by resolving repeated slashes, current-directory and parent-directory segments, using a stack.
Stacks & Queuesstackstring-parsingsimulationpaths - Stacks & QueuesEasyAuto-gradedLeftover Brackets After Pairing Up a Parenthesis String
Count the parentheses left over after forming the maximum number of valid "(" before ")" pairs, testing a greedy counter scan or stack over a string.
Stacks & Queuesstackgreedystringsparentheses - Stacks & QueuesMediumAuto-gradedInfer Execution Events from Call Stack Snapshots
Reconstruct chronological function START and END lifecycle events by evaluating structural differences across consecutive call stack snapshots.
Stacks & Queuesstacks-queuesarraysstrings - Stacks & QueuesMediumAuto-gradedFour-Function Calculator Without Parentheses
Evaluate a string of non-negative integers with +, -, *, / and spaces, honoring precedence and truncating division toward zero, without using eval.
Stacks & Queuesstring-parsingstackoperator-precedencesimulation - Stacks & QueuesMediumAuto-gradedExpand a Compressed Bracket Pattern String
Tests stack-based parsing of nested repeat-count patterns, including multi-digit counts, nesting, and trailing letters, to rebuild the fully expanded string.
Stacks & Queuesstackstringparsingnested-structures - Stacks & QueuesMediumAuto-gradedExpand a Compact Pattern with Nested Multipliers
Expand a string in which a positive integer followed by a bracketed block means that block repeats, with nesting; tests stack or recursive parsing and multi-digit number handling.
Stacks & Queuesstackstring-parsingnested-structuresrecursion - Stacks & QueuesMediumAuto-gradedUnwrap Deeply Nested Lists Into One Sequence
Collect every integer from a structure of arbitrarily deep nested lists in left-to-right order, without recursion, so extremely deep inputs do not overflow the call stack.
Stacks & Queuesstackdfsiteratorsnested-lists - Stacks & QueuesEasyAuto-gradedBalanced Delimiters Checker
Decide whether a string made only of round, square and curly brackets is correctly paired and nested, which tests stack-based matching and edge-case handling.
Stacks & Queuesstackstringsparsing - Stacks & QueuesEasyAuto-gradedCheck Block Nesting in a Flat Marker Sequence
Scan a list of tokens and decide whether every OPEN-style marker is matched by a later close marker, using a running counter and early rejection.
Stacks & Queuescounterbalanced-bracketssingle-passstrings - Stacks & QueuesMediumAuto-gradedWait Time Until a Strictly Larger Sensor Value
Find, for each position in a sequence, the distance to the next strictly larger element, using a monotonic stack to achieve linear time.
Stacks & Queuesmonotonic-stackarraysnext-greater-element - Stacks & QueuesMediumAuto-gradedSmallest Subsequence Containing Each Letter Once
Build the lexicographically smallest subsequence that uses every distinct letter of a string exactly once, using a greedy monotonic stack with remaining-count tracking.
Stacks & Queuesmonotonic-stackgreedystringssubsequence - Stacks & QueuesMediumAuto-gradedEvaluate a Spaced Arithmetic String Without Parentheses
Evaluate an integer expression with +, -, *, / using standard precedence and truncating division, in a single pass over a string with arbitrary spacing.
Stacks & Queuesparsingstringstackoperator-precedence - Stacks & QueuesMediumAuto-gradedParenthesized Integer Calculator with Unary Negation
Evaluate an integer expression with +, -, *, /, parentheses and unary minus in one iterative pass, using precedence rules and division that truncates toward zero.
Stacks & Queuesstackparsingexpression-evaluationshunting-yard - Stacks & QueuesMediumAuto-gradedExpand Nested Repeat Notation into a Full String
Expand a string containing nested count[text] repeat groups into its full form, using a stack or recursion to parse multi-digit counts and nesting correctly.
Stacks & Queuesstackstring-parsingnested-structuresrecursion - Stacks & QueuesMediumAuto-gradedDeserialize Nested List Structure
Parse a string encoding nested lists and non-negative integers into a Python list structure.
Stacks & Queuesstacksstringsparsingrecursion - Stacks & QueuesMediumAuto-gradedStrip Unmatched Brackets From a Text Line
Delete exactly the brackets that cannot be paired so the remaining text is well-formed, using a single linear scan with a stack or counters.
Stacks & Queuesstackstringparenthesesgreedy - Stacks & QueuesEasyAuto-gradedRight-Side Larger Neighbor Lookup for Selected Values
Tests whether you can precompute the nearest strictly larger value to the right for every element using a monotonic stack, then answer lookups for a chosen list of values.
Stacks & Queuesmonotonic-stackhash-maparrays - Stacks & QueuesMediumAuto-gradedExpand Nested Repeat Patterns in an Encoded String
Tests stack-based parsing of nested, multi-digit repeat patterns of the form count[text] to rebuild the fully expanded string.
Stacks & Queuesstackstring-parsingnested-structuredecoding - Stacks & QueuesMediumAuto-gradedLongest Stretch With Bounded Spread
Find the longest contiguous stretch of an integer list whose largest and smallest values differ by at most a tolerance, using a sliding window with monotonic deques.
Stacks & Queuessliding-windowmonotonic-dequearraystwo-pointers - Stacks & QueuesMediumAuto-gradedResolve Field Paths in a Nested Message Schema
Parse brace-delimited nested message definitions line by line, then check which dotted query paths name an actual field, tracking scope with a stack.
Stacks & Queuesparsingstackhash-setstrings - Stacks & QueuesEasyAuto-gradedCheck Whether Bracket Pairs Are Correctly Nested
Decide whether a string of round, square and curly brackets is well formed, which tests the use of a stack for last-in-first-out matching.
Stacks & Queuesstackstringsparsing - Stacks & QueuesEasyAuto-gradedWell-Formed Bracket Sequence Checker
Decide whether a string of three kinds of brackets is correctly nested, using a stack to enforce that the most recently opened bracket is closed first.
Stacks & Queuesstackstringmatchingparsing - Stacks & QueuesMediumAuto-gradedValidate Deep Structure Equivalence
Recursively or iteratively check if two arbitrarily nested data structures are identical in type, shape, and value.
Stacks & Queuesrecursionstackdata-structureshashing - Stacks & QueuesEasyAuto-gradedCancel Neighboring Letter Pairs in a String
Tests using a stack to repeatedly cancel adjacent equal characters in a string, including cascading cancellations, in linear time.
Stacks & Queuesstackstringsimulation - Stacks & QueuesMediumAuto-gradedPer-Function Self Time from a Call Trace
Sweep a single-threaded call trace with a stack to total each function's self time under half-open intervals, with recursion, strict validation, and name-sorted output.
Stacks & Queuesstacksimulationhash-mapvalidation - Stacks & QueuesEasyAuto-gradedCollapse Repeated Letters: Pair Cancel or Full Run Wipe
Simulate cascading deletions of equal neighbouring letters with a stack, either cancelling pairs or erasing whole leftmost runs, and return what is left.
Stacks & Queuesstackstringsimulationrun-length - Stacks & QueuesHardAuto-gradedDetermine Pass Times for Single-Lane Security Gate
Simulate the scheduling of access requests through a shared resource using state tracking and queues under conflict-resolution rules.
Stacks & Queuesstacks-queuessimulationarrays