KatInterview

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

Coding 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 31–60 of 650 results

  • Data Structure DesignHardModel answer
    Thread-Safe In-Memory Store and Sliding-Window Counter

    Find the concurrency bugs in an in-memory key-value store with expiry and a 300-second hit counter, then fix them with appropriate locking and describe how to test.

    Data Structure Designconcurrencyrace-conditionslockingthread-safety
  • Data Structure DesignMediumModel answer
    Build a Grouped, Promo-Aware, Sorted Receipt Printer

    Extend a cart class that turns scanned item names into a receipt: itemized total, grouping by type, a buy-three-get-two-free deal, then alphabetical ordering.

    Data Structure Designobject-oriented-designhash-maprefactoringmoney-arithmetic
  • Data Structure DesignMediumModel answer
    Layered REST API for Text Condensing with FastAPI

    Design a small FastAPI service that accepts text, returns a placeholder-generated summary, validates input, handles errors, and keeps a bounded in-memory history, using clear layers.

    Data Structure Designfastapipythonpydanticrest-api
  • StringsEasyModel answer
    Letter-Match Feedback Widget for a Five-Letter Word Game

    Build a small browser widget that scores a typed guess of up to five letters against a fixed secret word, marking each letter exact, misplaced or absent, with sound input handling.

    Stringsstringsfrontendstate-managementinput-validation
  • Data Structure DesignEasyModel answer
    Resolving Name Clashes Across Two Python Parent Classes

    Predict which inherited method runs when a class has two parents defining the same method name, and explain Python's lookup order, super() cooperation, and alternatives.

    Data Structure Designpythoninheritancemroc3-linearization
  • Data Structure DesignMediumModel answer
    Design an Audio Player Core with Queue Management and Shuffle Logic

    Architect the object-oriented structure and state machine for a media player featuring play/pause controls, queue prioritization, looping modes, and deterministic shuffle handling.

    Data Structure DesignObject-Oriented DesignState MachineData Structure Design
  • Data Structure DesignMediumModel answer
    Build a Playing-Card Deck with Fair Shuffle and Custom Sort

    Model a 52-card deck, return an unbiased random permutation, and list the cards in a defined rank-then-suit order, with data structures and complexity explained.

    Data Structure Designobject-oriented-designshufflefisher-yatessorting
  • 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
  • Greedy & IntervalsMediumModel answer
    Find the Largest Non-Decreasing Integer Below N

    Find the maximum integer less than or equal to n whose decimal digits do not decrease from left to right.

    Greedy & Intervalsgreedymath-bitsstrings
  • Trees & GraphsMediumModel answer
    Reconstruct Binary Tree from Inorder and Postorder Sequences

    Reconstruct a binary tree given its inorder and postorder traversal arrays, assuming all node values are unique.

    Trees & Graphstrees-graphsrecursionhash-table
  • Data Structure DesignEasyModel answer
    Fleet Command Console for Grid-Walking Robots

    Design a text-driven controller that manages several robots on an unbounded grid, handling turns, steps, selection, error cases and cell collisions.

    Data Structure Designsimulationhash-mapcommand-parsingstate-machine
  • Dynamic ProgrammingHardModel answer
    Maximize Allocation Across Server Pools with Migration Limits

    Aggregate daily resource usages and calculate optimal allocations under unrestricted and migration-bounded pool selection constraints using dynamic programming.

    Dynamic Programmingarraysdynamic-programminggreedy-intervals
  • Data Structure DesignMediumModel answer
    Build a Weighted Hash Ring for Sharding Keys Across Servers

    Design a hash ring with weighted virtual nodes that assigns keys to servers, supports adding and removing servers with little key movement, and handles collisions and concurrency.

    Data Structure Designconsistent-hashingvirtual-nodesbinary-searchthread-safety
  • Data Structure DesignMediumModel answer
    Function Composition Twice and Core Container Cost Comparison

    Write a helper that feeds a function's output back into itself, explain closures and side effects, then compare arrays, linked lists, stacks and queues by operation cost.

    Data Structure Designhigher-order-functionsclosuresside-effectscomplexity-analysis
  • Math & Bit ManipulationEasyModel answer
    Implement Iterative and Recursive Factorial with Integer Squares

    Write iterative and recursive factorial functions alongside a sequence of integer squares, focusing on input validation, edge cases, and stack vs. loop complexity.

    Math & Bit Manipulationmathrecursioniterationpython
  • Data Structure DesignMediumModel answer
    Build a Fire-Once Event Gate for Concurrent Threads

    Design a thread-safe one-shot event gate with fire, timed wait and non-blocking status check, avoiding lost wakeups, spurious-wakeup bugs and busy-waiting.

    Data Structure Designconcurrencycondition-variablethreadingsynchronization
  • Data Structure DesignMediumModel answer
    Weighted Random Picker with Live Weight Updates

    Build a container that returns items at random with probability proportional to their weights, supports re-weighting existing items, and keeps picks fast and memory small.

    Data Structure Designfenwick-treeprefix-sumsrandom-samplingbinary-search
  • Data Structure DesignMediumModel answer
    Build a Wildcard-Aware URL Router with Literal Priority

    Design a router that stores path templates with {name} wildcards and resolves concrete paths to a handler plus captured values, preferring exact segments and backtracking when they dead-end.

    Data Structure Designtriebacktrackingroutingstring-parsing
  • Data Structure DesignHardModel answer
    In-Memory Bank With Delayed Payments, Cancellation and Spend Ranking

    Extend an in-memory bank with delayed payments that can be canceled, record success or failure for each, discard stale entries, and rank accounts by total outgoing money.

    Data Structure Designdesign-dsheaplazy-deletionsimulation
  • Trees & GraphsMediumModel answer
    Identify Node Value Present Across Most Depth Levels

    Find the binary tree node value that appears across the highest number of unique depth levels.

    Trees & Graphstrees-graphsbreadth-first-searchhash-table
  • Trees & GraphsHardModel answer
    Region-Splitting Tree and Multi-Word Grid Search

    Compress a square character grid into a four-way region tree, then locate a batch of words in the grid by walking neighbors in eight directions without reusing cells.

    Trees & Graphsquadtreetriebacktrackingdivide-and-conquer
  • Greedy & IntervalsMediumModel answer
    Staffing Timeline from Overlapping Work Shifts

    Turn a list of overlapping employee shifts into contiguous time segments, each listing who is on duty, with empty segments marking gaps in coverage.

    Greedy & Intervalssweep-lineintervalshash-mapsorting
  • StringsMediumModel answer
    String Internals, Move Costs, and Threads vs Async Tasks

    Describe how a string is laid out in memory, what copying and moving really cost, what a Rust move does, and how OS threads differ from async coroutines.

    Stringsstringsmemory-managementmove-semanticsrust
  • Data Structure DesignMediumModel answer
    Upgrade a Streaming Log Filter to Multi-Code and JSON Output

    Refactor a small Python log-counting script so it filters on several status codes, optionally writes JSON, streams multi-gigabyte files in constant memory, and stays unit-testable.

    Data Structure Designpythonrefactoringstreamingcli
  • Data Structure DesignMediumModel answer
    Build a Heap Allocator with Fit Policies and Safe Handles

    Design a simulated memory manager over a fixed address range that supports two placement policies, splitting, merging of neighbors, and rejection of stale or forged release requests.

    Data Structure Designmemory-allocatorlinked-listhash-mapcoalescing
  • Arrays & HashingHardModel answer
    Distinct Subset Sums With Negatives and Repeated Values

    List every distinct multiset of array values, each index used at most once, that sums to a target when negatives, zeros and duplicates are present. Output must be sorted.

    Arrays & Hashingbacktrackingpruningdeduplicationsubsets
  • Data Structure DesignMediumModel answer
    Build a CSR Container and Multiply It by a Dense Vector

    Design a class that compresses a mostly-zero integer matrix into three CSR arrays, then use it to compute a matrix-vector product in time proportional to the non-zero count.

    Data Structure Designsparse-matrixcsrmatrix-vector-multiplicationdata-structure-design
  • Data Structure DesignMediumModel answer
    Build a Polite Web Crawler with Letter-Coverage Ordering

    Design and implement a rate-limited article crawler that visits pages with unseen first letters before switching to random order, and explain how you would use an AI assistant to build it.

    Data Structure Designweb-crawlerrate-limitingfrontier-designai-pairing
  • Data Structure DesignHardModel answer
    Bank Ledger with Holds, Expiring Transfers and Customer Merge

    Build an in-memory bank that supports deposits, payments, two-step transfers with expiring holds, a top-activity ranking, and customer merges that leave history untouched.

    Data Structure Designobject-oriented-designhash-mapheaplazy-expiry
  • Data Structure DesignMediumModel answer
    Build a Minesweeper Engine That Scales to Huge Sparse Grids

    Design a Minesweeper class with board rendering and click handling via flood fill, then adapt it to enormous boards with few mines using lazy state and on-demand counting.

    Data Structure Designdesignflood-fillbfssparse-data-structures