KatInterview

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

Coding Interview Problems

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

6016
Problems
2229
Auto-graded
15
Topics
274
Added today

Showing 781–810 of 2128 results

  • Arrays & HashingMediumAuto-graded
    Grid Editor: Flip Rows, Swap Rows, and Turn Clockwise

    Simulate a sequence of string commands (row reversal, row swap, 90-degree clockwise turn) on a rectangular grid whose shape changes after each turn.

    Arrays & Hashingmatrixsimulationstring-parsingrotation
  • Heaps, Sorting & SearchMediumAuto-graded
    Find Frequent Elements with Custom Tie-Breaking

    Count item occurrences and retrieve the top k highest-frequency elements, sorting tied elements by value ascending.

    Heaps, Sorting & Searcharrayssortinghash-table
  • Arrays & HashingMediumAuto-graded
    Product of Two Mostly-Zero Grids

    Compute the product of two mostly-zero integer matrices by precomputing nonzero positions so that no work is spent on zero operands.

    Arrays & Hashingmatrixsparsesimulationhashing
  • Greedy & IntervalsEasyAuto-graded
    Minimum Days to Complete Sequential Tasks With Daily Time Budgets

    Greedy single-pass simulation: pack tasks in order into daily time budgets without splitting, and return the day count or -1 if impossible.

    Greedy & Intervalsgreedysimulationtwo-pointersarrays
  • Stacks & QueuesMediumAuto-graded
    Unscramble a Cipher-Encoded Nested Outline

    Parse a parenthesized pre-order tree string with a stack and undo a letter-substitution cipher, where each node's text is the run just before its closing parenthesis.

    Stacks & Queuesstackstring-parsingtree-deserializationsubstitution-cipher
  • Math & Bit ManipulationEasyAuto-graded
    Simple OLS Linear Regression Fitting

    Compute the slope and intercept for a univariate linear regression model using ordinary least squares.

    Math & Bit Manipulationmatharraysstatistics
  • Data Structure DesignMediumAuto-graded
    Rolling Window Stats: Unique Senders and Peak Message Size

    Replay a list of operations on a fixed-size sliding window, reporting the distinct sender count and the largest payload size after each insertion.

    Data Structure Designsliding-windowdequehash-mapheap
  • Data Structure DesignMediumAuto-graded
    Prefix-Compressed Trie for Integer Sequences

    Simulate operations on a prefix-compressed radix tree storing integer sequences, supporting sequence insertions and depth-first tree serialization.

    Data Structure Designradix-treetriedata-structure-designtrees
  • Arrays & HashingEasyAuto-graded
    Modular Product Exclude Current Element

    Compute the modular product of all elements in an array except the current element for each index without division.

    Arrays & Hashingarraysprefix-summath
  • Linked ListsEasyAuto-graded
    Reverse a Sequence of Node Values

    Tests the ability to reverse a sequential list of numbers efficiently, mimicking linked list reversal operations.

    Linked Listslinked-listsarrayspointers
  • Greedy & IntervalsMediumAuto-graded
    Room Count and Heaviest Prerequisite Chain for Sessions

    Combine an interval-overlap sweep with a min-heap and a longest weighted path on a DAG using topological order.

    Greedy & Intervalsintervalsmin-heaptopological-sortdag
  • Data Structure DesignMediumAuto-graded
    Escrow-Style Ledger with Expiring Transfers and Account Merging

    Simulate an in-memory ledger with held transfers that expire after a day, account merging, and a ranking of accounts by completed outgoing totals.

    Data Structure Designsimulationhash-mapheapstate-management
  • Data Structure DesignMediumAuto-graded
    Rolling Mean Over the Latest K Readings

    Simulate a rolling-window mean over a stream of readings, handling the warm-up phase and keeping floating-point error from accumulating across long streams.

    Data Structure Designsliding-windowqueuefloating-pointsimulation
  • Data Structure DesignEasyAuto-graded
    Simulate Rate Limiter Decisions

    Simulate a thread-safe fixed-window rate limiter processing a sequence of request timestamps.

    Data Structure Designdesignsimulationarrays
  • Greedy & IntervalsMediumAuto-graded
    Compute Free Windows from Schedule Constraints

    Compute unreserved time windows for specified daily schedules given opening hours and existing bookings.

    Greedy & Intervalsintervalssortingstringgreedy
  • Arrays & HashingEasyAuto-graded
    Compute Aggregate Distance Tolls for Interleaved Logs

    Process interleaved time-ordered scanner events to compute cumulative segment-based charges across all entities.

    Arrays & Hashinghash-maparraysimulation
  • Arrays & HashingMediumAuto-graded
    Quickest Way to Cover a Set Distance From Per-Interval Odometer Data

    Find the top average speed over any time window covering exactly a target distance, given piecewise-constant speeds. Tests prefix sums, interpolation and binary search.

    Arrays & Hashingprefix-sumsbinary-searchinterpolationtwo-pointers
  • Greedy & IntervalsMediumAuto-graded
    Resolve Overlapping Text Edit Spans by Priority

    Sweep over span boundaries with a heap to resolve overlapping inclusive edit spans using priority, original length, and input order, splitting losers into fragments.

    Greedy & Intervalsintervalssweep-lineheaptie-breaking
  • Math & Bit ManipulationMediumAuto-graded
    Chance That Two Random Draws Multiply to More Than a Half

    Compute the exact probability that the product of two independent Uniform(0,1) values exceeds 1/2, by integrating over the region of the unit square above a hyperbola.

    Math & Bit Manipulationprobabilityintegrationcontinuous-distributionsclosed-form
  • Trees & GraphsMediumAuto-graded
    Spreading Pop Wave Across a Square Balloon Grid

    Compute the earliest time each cell of a square grid is reached by a wave spreading from several seed cells, using multi-source breadth-first search.

    Trees & Graphsbfsgridmulti-sourceshortest-path
  • Heaps, Sorting & SearchMediumAuto-graded
    Newest-First Transaction Pager with Offset and Cursor Modes

    Build a pager over transaction records that sorts newest-first with a deterministic tie-break and supports offset and keyset-cursor navigation with correct metadata.

    Heaps, Sorting & Searchsortingpaginationkeyset-cursortie-breaking
  • Heaps, Sorting & SearchMediumAuto-graded
    Find Pair of Integers with Sum Nearest to Zero

    Find a pair of distinct elements in an array whose sum has the smallest absolute value, breaking ties deterministically.

    Heaps, Sorting & Searcharraysbinary-searchsortingtwo-pointers
  • Math & Bit ManipulationHardAuto-graded
    Subset Count Under Sum Constraint and Divisor Index

    Find the maximum number of elements from an array whose sum is at most a given target n, and compute the k-th smallest positive divisor of a number N.

    Math & Bit Manipulationmathsortinggreedyprefix-sum
  • Arrays & HashingMediumAuto-graded
    Paint Stacked Boxes onto a Character Grid

    Simulate painting bordered, filled boxes onto a fixed-size text grid, clipping to the grid while keeping border and interior status based on the full box.

    Arrays & Hashingsimulation2d-gridclippingstrings
  • Data Structure DesignEasyAuto-graded
    Simulate a Forward-Only Row Cursor

    Simulate a forward-only cursor over a list of rows, where a peek call is side-effect free and an advance call returns the next row or None at the end.

    Data Structure Designsimulationiteratorcursordesign
  • Trees & GraphsMediumAuto-graded
    Verify Root-to-Leaf Sequence in Binary Tree

    Check if a list of integers forms a complete valid root-to-leaf path in a binary tree given as an adjacency table.

    Trees & Graphstrees-graphstreearray
  • Arrays & HashingEasyAuto-graded
    Fill a Grid With Connected Crop Strips in Snake Order

    Build an N by M grid in which each crop forms one edge-connected region, using a snake-order fill with a fixed, deterministic output.

    Arrays & Hashinggridconstructionsimulationserpentine
  • Stacks & QueuesEasyAuto-graded
    Stack Simulator with Constant-Time Minimum Queries

    Simulate a sequence of stack commands and answer minimum queries in constant time by tracking the running minimum alongside each element.

    Stacks & Queuesstackdesignsimulationauxiliary-stack
  • Data Structure DesignHardAuto-graded
    Running Bit-Entropy of a Token Feed with Stable Updates

    Maintain Shannon entropy of a growing token stream with constant-time updates and queries, avoiding catastrophic cancellation when one token dominates.

    Data Structure Designstreamingnumerical-stabilityhash-mapentropy
  • Arrays & HashingEasyAuto-graded
    Most Frequent Log Error Codes in Time Interval

    Filter log entries within a half-open time interval, compute occurrence frequencies, and retrieve the top k error codes sorted by frequency and string order.

    Arrays & HashingArrays & HashingSortingHash Table