KatInterview

practice a little every day — you've got this ♡

Stacks & Queues Interview Problems

Practice 5965 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.

5965
Problems
2208
Auto-graded
15
Topics
271
Added today

Showing 1–19 of 19 results

  • Stacks & QueuesMediumModel answer
    Line of Sight Counts for Each Person in a Row

    For each person in a row, count how many people further right they can see when anyone standing between must be shorter than both of them. Needs an O(n) approach.

    Stacks & Queuesmonotonic-stackarraysamortized-analysisnext-greater-element
  • Stacks & QueuesMediumModel answer
    Java Concurrent Collections Deep Dive: ConcurrentHashMap and Queues

    Explore the internal architecture, thread-safety mechanisms, and practical performance trade-offs of Java's ConcurrentHashMap and concurrent queue variants.

    Stacks & Queuesjavaconcurrencydata-structuresmultithreading
  • Stacks & QueuesMediumModel answer
    Build a Calculator with Variables, Unary Signs and Parentheses

    Write a linear-time evaluator for integer expressions with variables, precedence, unary signs, parentheses, truncating division and 64-bit error handling.

    Stacks & Queuesparsingrecursive-descentexpression-evaluationtokenization
  • Stacks & QueuesMediumModel answer
    Build a Tiny Expression Language Interpreter in Three Stages

    Implement a lexer, recursive-descent parser and evaluator for a small integer language with variables, unary minus, precedence, truncating division and print.

    Stacks & Queuesparsinginterpreterrecursive-descentast
  • Stacks & QueuesMediumModel answer
    Arithmetic String Calculator with Operator Precedence

    Compute the integer result of a string holding non-negative numbers, four operators and spaces, honoring precedence and truncating division, without eval and with linear time.

    Stacks & Queuesparsingstackstringoperator-precedence
  • Stacks & QueuesMediumModel answer
    Troubleshooting Silent Execution in Python Async Workflows

    Analyze and fix a Python async script that finishes silently without invoking its async functions, and explore concurrent execution options with asyncio.

    Stacks & Queuespythonasyncioconcurrencydebugging
  • Stacks & QueuesMediumModel answer
    Simulated Stock Trading Signals and Two-Char String Reduction

    Solve two streaming state problems: daily stock trading based on sign patterns in O(N) time and two-character substring elimination using an in-place stack.

    Stacks & Queuesstacks-queuesarraysstringsmath-bits
  • Stacks & QueuesMediumModel answer
    Build a Stack-Based Mini Language Interpreter in Python

    Write an interpreter that parses a line-based program of LOAD, STORE and integer arithmetic instructions, runs it on an operand stack, and returns the final variable memory.

    Stacks & Queuesinterpreterstackparsingerror-handling
  • Stacks & QueuesEasyModel answer
    Run a Tiny Postfix Command Interpreter with Error Codes

    Simulate a small stack machine over whitespace-separated tokens, handling arithmetic, DUP, POP and PRINT, and stop at the first error while keeping the output produced so far.

    Stacks & Queuesstacksimulationparsingerror-handling
  • Stacks & QueuesMediumModel answer
    Build a Multi-Room Async TCP Chat Server

    Implement a concurrent, room-based TCP chat server in Python using asyncio, featuring command processing, scoped broadcasts, backpressure handling, and strict resource cleanup.

    Stacks & Queuesconcurrencyasyncionetworkingpython
  • Stacks & QueuesMediumModel answer
    Evaluate Arithmetic Expressions and Decode Nested Run-Length Strings

    Implement two production-ready string parsers: an arithmetic evaluator supporting basic operators and precedence, and a nested string expansion utility.

    Stacks & Queuesstackparsingstringsexpression-evaluation
  • Stacks & QueuesMediumModel answer
    Predicting Output Order with the Browser Event Loop

    Work out the print order of a short script mixing timers, promises and microtasks, then explain how the browser event loop schedules each kind of task.

    Stacks & Queuesjavascriptevent-loopasyncmicrotasks
  • Stacks & QueuesMediumModel answer
    Evaluate Prize-Pool Formulas with Strictly Positive Whole Steps

    Parse and evaluate an infix arithmetic string, rejecting it with False if any intermediate result is zero, negative, or a non-integer quotient.

    Stacks & Queuesparsingrecursive-descentexpression-evaluationvalidation
  • Stacks & QueuesMediumModel answer
    Group Deletion Stack and Boundary Path Collection

    Remove consecutive identical-character groups from a string and collect a binary tree's boundary nodes in a specific mirror order.

    Stacks & Queuesstackbinary-treestring-manipulationrun-length-encoding
  • Stacks & QueuesMediumModel answer
    Compute Per-Function Runtimes from a Profiler Event Log

    Parse a time-ordered sequence of START/END events, compute inclusive and exclusive runtimes per function, and identify the most expensive function by self-time.

    Stacks & Queuesstacksimulationprofilingcall-stack
  • Stacks & QueuesMediumModel answer
    Maximize Throughput in a Serial Manufacturing Pipeline

    Design 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.

    Stacks & Queuessimulationschedulingqueuesthroughput
  • Stacks & QueuesHardModel answer
    Build a Type-Safe C++ Stack from Raw Storage

    Implement a generic, dynamically growing C++ stack using raw memory and placement new, then defend every lifetime, allocation, and call-semantics decision.

    Stacks & QueuesC++memory-managementtemplatesobject-lifetime
  • Stacks & QueuesMediumModel answer
    Stack Trace Event Stream from Periodic Samples

    Convert a sequence of call stack snapshots into function entry and exit events with configurable debouncing to filter transient frames.

    Stacks & Queuesstacksarrayssimulationstate-machine
  • Stacks & QueuesMediumModel answer
    Parse and Compute Arithmetic Expression with Recursion

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

    Stacks & Queuesrecursionparsingoperatorsdfs