KatInterview

Topic

Stacks & Queues interview problems

Monotonic stacks, parsing and simulation. 112 original problems, each with hidden test cases you can run in the browser.

Problems112

22 easy74 medium16 hard

Showing 91–112 of 112 results

  • Write a parser that evaluates arithmetic expressions with integers, four operators, parentheses, and unary negation using recursive descent or explicit stack DFS.

    Model answerrecursionparsingoperatorsdfs
  • Tests monotonic stack usage to efficiently find next smaller-or-equal elements and aggregate results with index tracking.

    Auto-gradedmonotonic-stackarraysaggregation
  • Tests deep bracket-matching with multiplicative expansion rules by validating and evaluating a chemical-formula-style string with nested parentheses and numeric multipliers.

    Auto-gradedstacksbracket matchingparsingsimulation
  • Tests whether candidates can simulate bracket-matching logic with named tags, enforcing strict open/close pairing and proper nesting order.

    Auto-gradedstacksbracket matchingparsingsimulation
  • Tests expression evaluation using a monotonic/operator-precedence stack to correctly parse and compute a string containing +, -, *, /, parentheses, and nested ternary operators.

    Auto-gradedstacksexpression evaluationparsingmonotonic stack
  • Tests stack trace interpretation, event inference from sparse data, and algorithmic reasoning about nesting and correctness.

    Auto-gradedstacksalgorithmsdata-structures
  • Tests the ability to optimize subarray sum queries using prefix sums and monotonic deque when values can be negative.

    Auto-gradedprefix-sumsmonotonic-dequesliding-windowarray
  • Tests ability to evaluate a string expression containing non-negative integers, +, -, *, / operators, and parentheses using a stack-based approach.

    Auto-gradedstacksexpression evaluationparsing
  • Tests the ability to use a monotonic stack to efficiently find, for each day, how many days until a strictly warmer temperature is recorded.

    Auto-gradedstackmonotonic stackarray
  • Tests queue simulation by modeling a shared printer that interleaves multi-page jobs across rounds, returning the final page-output order.

    Auto-gradedqueuesimulationarrays
  • Tests ability to compute positional diffs between consecutive call stack snapshots and emit correctly ordered START/END events using a stack-based mental model.

    Auto-gradedstacksimulationstring manipulation
  • Tests queue simulation skills by modeling vehicles routing through toll lanes with dynamic overflow and lane-closing logic.

    Auto-gradedqueuesimulationgreedy
  • Tests bracket matching using a stack to enforce context-sensitive nesting rules across four distinct bracket types with extra validity constraints.

    Auto-gradedstacksbracket matchingparsingsimulation
  • Tests the ability to apply a monotonic stack to find the largest rectangular area under a histogram while skipping columns that are marked as forbidden.

    Auto-gradedmonotonic stackarraysgeometry
  • Tests bracket matching logic by verifying that a simplified markup string with typed opening/closing tags is correctly nested and properly closed.

    Auto-gradedstackparsingsimulation
  • Tests bracket matching by parsing a string of typed scope-open/close tokens and verifying correct nesting, ordering, and balance according to a precedence table.

    Auto-gradedstacksbracket matchingparsingsimulation
  • Tests the ability to use a monotonic stack to efficiently find, for each building in a skyline, the index of the nearest building to its left that is strictly taller.

    Auto-gradedmonotonic stackarraysstack
  • Tests ability to use a monotonic stack to compute, for each building, how many previous buildings it "blocks" and find the building that maximally reduces the visible skyline count.

    Auto-gradedmonotonic stackarrayssimulation
  • Tests whether a candidate can use a stack to correctly evaluate a postfix arithmetic expression involving integers and the four basic operators.

    Auto-gradedstacksexpression evaluationsimulation
  • Tests queue simulation by processing print jobs where higher-priority jobs preempt lower-priority ones, requiring candidates to track position and reorder the queue correctly.

    Auto-gradedqueuesimulationgreedy
  • Tests bracket matching with complex rules: typed pairs, mandatory ordered sub-structure inside scopes, and precedence-aware nesting constraints.

    Auto-gradedstacksbracket matchingparsingsimulation
  • Tests the ability to simulate a round-robin service queue where customers cycle back if unserved, tracking when each customer is finally served.

    Auto-gradedqueuesimulationdata structures

More topics