Topic
Stacks & Queues interview problems
Monotonic stacks, parsing and simulation. 112 original problems, each with hidden test cases you can run in the browser.
22 easy74 medium16 hard
Showing 61–90 of 112 results
Checks whether a string of mixed parentheses, braces, and square brackets is properly nested, testing stack-based matching and early rejection in linear time.
Auto-gradedstackparsingstringmatchingRemove consecutive identical-character groups from a string and collect a binary tree's boundary nodes in a specific mirror order.
Model answerstackbinary-treestring-manipulationrun-length-encodingParse a time-ordered sequence of START/END events, compute inclusive and exclusive runtimes per function, and identify the most expensive function by self-time.
Model answerstacksimulationprofilingcall-stackTests ability to diff consecutive call-stack snapshots using longest-common-prefix analysis and stack unwinding to produce ordered START/END lifecycle events.
Auto-gradedstacksimulationtwo-pointersTests understanding of monotonic deques to efficiently track the largest element across consecutive fixed-size subarrays in linear time.
Auto-gradeddequesliding-windowmonotonic-queueDesign and simulate a fixed-time serial pipeline to maximize completed units, given per-stage processing times, inter-stage buffer capacities, and blocking-after-service rules.
Model answersimulationschedulingqueuesthroughputDecide whether a bracket-only string is properly nested and matched, using a LIFO stack of pending openers.
Auto-gradedstackstringsparsingTests whether you can emulate first-in-first-out ordering using only two LIFO stacks and explain the amortized cost of each operation.
Auto-gradedstacksqueueamortized-analysisTests 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.
Auto-gradedstacksimulationinterval-reasoningImplement a generic, dynamically growing C++ stack using raw memory and placement new, then defend every lifetime, allocation, and call-semantics decision.
Model answerC++memory-managementtemplatesobject-lifetimeTests stack-based bracket validation and modular arithmetic to rotate lowercase letters circularly across the alphabet.
Auto-gradedstacksstringsmodular-arithmeticTests building an operator-precedence parser using stacks to handle binary operations, unary negation, parentheses, and zero-truncating division.
Auto-gradedstacksparsingoperator-precedencestring-processingTests stack-based simulation of iterative removals that trigger chain reactions when fragments recombine.
Auto-gradedstackstringsimulationTests 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.
Auto-gradedmonotonic stackarrayssimulationTests stack-based bracket validation, interval merging with endpoint semantics, and arithmetic evaluation with unary operators.
Auto-gradedstacksintervalsparsingexpression-evaluationTests stack-based bracket matching: find and remove the fewest characters from a parentheses-only string to leave a fully balanced result.
Auto-gradedstacksstringsgreedyTests stack-based matching to find the minimum set of parenthesis indices that must be removed to balance a string.
Auto-gradedstackstring-processinggreedyTests bracket matching with domain-specific pairing rules where round, square, and curly brackets each have distinct valid nesting constraints.
Auto-gradedstacksbracket matchingsimulationstringsTests parsing and evaluating mathematical expressions with proper operator precedence and parentheses using stack-based techniques.
Auto-gradedstacksexpression-parsingoperator-precedenceTests event-driven simulation skills: tracking visitor state, enforcing a seating capacity, managing a FIFO waitlist, and collecting one-time entry fees.
Auto-gradedsimulationqueuehash-setConstruct a sequence that rises then falls while respecting per-element caps, maximizing the sum using greedy peak selection and monotonic stacks.
Auto-gradedmonotonic-stackgreedyprefix-sumConvert a sequence of call stack snapshots into function entry and exit events with configurable debouncing to filter transient frames.
Model answerstacksarrayssimulationstate-machineTests greedy thinking and stack-based reversal to build the smallest digit string satisfying a sequence of increase and decrease constraints.
Auto-gradedgreedystackstringsTests ability to parse and compute integer arithmetic respecting operator precedence without using eval or a full expression parser.
Auto-gradedparsingoperator-precedencestackTests expression evaluation using a monotonic/simulation stack to handle deeply nested signed bracket expressions with +/- operators and integer literals.
Auto-gradedstacksexpression evaluationparsingsimulationTests implementation of expression evaluation using stacks to handle operator precedence and parentheses correctly.
Auto-gradedstackexpression-parsingoperator-precedenceTests ability to parse and evaluate arithmetic expressions respecting operator precedence and left-to-right associativity without built-in eval.
Auto-gradedparsingoperator-precedencemathstring-processingTests efficient computation of the distance to the next strictly greater element using a monotonic stack to achieve linear time complexity.
Auto-gradedmonotonic-stacknext-greater-elementarraysTests stack-based simulation to eliminate adjacent equal characters iteratively until no more cancellations are possible.
Auto-gradedstackstring-manipulationsimulationTests stack-based matching for nested brackets and BFS position tracking to compute maximum horizontal distance in a binary tree.
Auto-gradedstackbfstree-traversalstring-validation