KatInterview

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

Coding Interview Problems

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

5972
Problems
2212
Auto-graded
15
Topics
273
Added today

Showing 121–150 of 2762 results

  • Heaps, Sorting & SearchMediumAuto-graded
    Greedy Tile Placement Across Parallel Lanes

    Simulate placing items one by one into the currently lowest lane, breaking ties by lowest index, and report each lane's final total using a min-heap.

    Heaps, Sorting & Searchheapgreedysimulationpriority-queue
  • Trees & GraphsMediumAuto-graded
    Minimum Rides Across Circular Shuttle Lines

    Find the fewest shuttle lines to board to get from one stop to another, using a graph search over lines and a stop-to-lines index to stay linear in total stops.

    Trees & Graphsbfsgraphhash-mapshortest-path
  • Greedy & IntervalsMediumAuto-graded
    Canonical Path Cleanup Plus Overlapping Range Union

    Combine stack-based Unix path normalization with sort-and-sweep merging of overlapping or touching closed ranges, returning both results in one list.

    Greedy & Intervalsstacksortingintervalsstrings
  • Arrays & HashingMediumAuto-graded
    Shortest Total Flight on a Circular Track of Stations

    Sum the shortest arc distances between consecutive stops on a ring with weighted edges, using prefix sums for O(1) arc queries.

    Arrays & Hashingprefix-sumcircular-arraysimulation
  • 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
  • Trees & GraphsMediumAuto-graded
    Edge Silhouettes of a Level-Order Binary Tree

    Build a binary tree from a level-order list with gaps and report the first and last node of every level, testing BFS level separation and level-order parsing.

    Trees & Graphsbinary-treebfslevel-ordertree-construction
  • Arrays & HashingHardAuto-graded
    Identify Most Popular Three-Page User Sequence

    Process website activity logs to compute chronological 3-site visit subsequences and find the most widely performed pattern across unique users.

    Arrays & Hashingarrayshash-tablesortingsubsequence
  • Data Structure DesignMediumAuto-graded
    Article Reaction Ledger with Recent Reversal Log

    Simulate a stream of up/down/clear reactions on articles, maintaining net scores and a bounded log of the three most recent reversals per article, all in constant time per operation.

    Data Structure Designhash-mapdequesimulationstate-tracking
  • Arrays & HashingEasyAuto-graded
    Rank Companion Items by Shared Collections

    Count how often each item shares a collection with a target item, then rank by count descending and name ascending, with an optional cap on the result length.

    Arrays & Hashinghash-mapcountingsortingco-occurrence
  • Math & Bit ManipulationMediumAuto-graded
    Expected Matching-Rank Pairs in a Random Card Hand

    Compute the expected number of same-rank card pairs in a hand drawn without replacement, using linearity of expectation over pairs of cards.

    Math & Bit Manipulationprobabilityexpectationcombinatoricslinearity-of-expectation
  • StringsMediumAuto-graded
    Minimal Distinguishing Abbreviations for a Word List

    Compute, for each word, the shortest leading substring shared with no other entry, using prefix counting or a trie, and return the whole word when none exists.

    Stringstrieprefixhash-mapstrings
  • 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
  • Trees & GraphsMediumAuto-graded
    Fewest Rolls to Park a Sliding Ball in a Grid

    Model a sliding ball as BFS over resting positions, where each edge is a full roll until a wall or border, and the target counts only if the ball stops on it.

    Trees & Graphsbfsgridgraphshortest-path
  • 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 DesignEasyAuto-graded
    Running Tally per Label from a Replayed Call Log

    Replay a log of increment calls and report, for each call, how many times its key has appeared so far, testing hash map counting and a simple operation-dispatch design.

    Data Structure Designhash-mapsimulationdesigncounting
  • 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 DesignMediumAuto-graded
    Fixed-Size Ring Buffer Command Simulator

    Simulate a bounded FIFO ring buffer driven by a list of commands, handling wrap-around, full and empty states, and returning each command's result in order.

    Data Structure Designdesignqueuering-buffersimulation
  • 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
  • Greedy & IntervalsHardAuto-graded
    Shared High-Activity Windows Across Sensor Feeds

    Merge step-function sensor feeds with a sweep over status-change events to find every maximal inclusive window in which all feeds are at or above a level.

    Greedy & Intervalssweep-lineintervalsstep-functionbinary-search
  • Math & Bit ManipulationEasyAuto-graded
    Binomial and Poisson Rare Event Tail Probabilities

    Computes the exact binomial tail probability P(X > k) and its Poisson approximation parameterised by lambda = n * p.

    Math & Bit Manipulationmathstatisticsprobability
  • 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
  • Arrays & HashingMediumAuto-graded
    Three-Bucket Rearrangement With Constant Extra Space

    Tests in-place three-way partitioning of an array holding only 0, 1 and 2 using constant extra space and a single linear pass, with careful pointer invariants.

    Arrays & Hashingtwo-pointersin-placepartitioningsorting
  • 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
  • Data Structure DesignMediumAuto-graded
    Expense Reimbursement Ledger Simulator

    Simulate an expense tracking ledger executing sequential API calls with validation and error checks.

    Data Structure Designdesign-dsarrayshash-table
  • 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
  • Trees & GraphsEasyAuto-graded
    Verify Root Sequence Match in N-ary Tree

    Determine if a given target sequence matches a top-down path in an N-ary tree represented by nested dictionaries.

    Trees & Graphstrees-graphsrecursiondfstree-traversal
  • Greedy & IntervalsMediumAuto-graded
    Collapse Booked Time Ranges Into Disjoint Blocks

    Combine closed integer ranges that overlap or share an endpoint into disjoint blocks, tests sorting plus a single sweep and careful boundary handling.

    Greedy & Intervalsintervalssortinggreedysweep
  • Data Structure DesignMediumAuto-graded
    Nested Undo-Log Session Store with Value Tallies

    Simulate an in-memory key-value store with nested transactions, a global commit, and a live per-value key tally, processing a batch of operations and returning each result.

    Data Structure Designhash-mapundo-logtransactionssimulation