KatInterview

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

Coding Interview Problems

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

6027
Problems
2232
Auto-graded
15
Topics
272
Added today

Showing 1021–1050 of 2785 results

  • 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 DesignMediumModel answer
    Efficient Large File Tailer and Sensor Heartbeat Monitor

    Read the last N lines of a huge file using reverse chunk seeking, and track active devices using an OrderedDict for fast sliding window health queries.

    Data Structure Designfile-iosliding-windowordered-dictsystem-design-ds
  • 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
  • Math & Bit ManipulationMediumModel answer
    Cheapest Cart Total with Percent-Off and Buy-X-Get-Y Promotions

    Define pricing rules for percent-off and buy-X-get-Y promotions, then build an algorithm that returns the lowest legal total for a cart, covering stacking, repeats, and rounding.

    Math & Bit Manipulationpricingdiscountsrequirements-clarificationgreedy
  • 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
  • Data Structure DesignHardModel answer
    Thread-Safe Idempotency Key Processor

    Design a thread-safe idempotency manager that executes tasks at most once per key, blocks concurrent callers, caches results with TTL, and cleans up expired records efficiently.

    Data Structure Designconcurrencycachingdesigndata-structures
  • 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
  • Greedy & IntervalsMediumModel answer
    Smallest Vehicle Pool for Location-Bound Shuttle Runs

    Given timed runs between named stops, find the fewest shuttles needed when each shuttle can only continue from the stop where its previous run ended.

    Greedy & Intervalssweep-linesortingeventsgreedy
  • 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 DesignMediumModel answer
    Design a Spreadsheet Data Model with Dependent Cell Evaluation

    Design the internal data structures and API for a spreadsheet engine supporting raw inputs, computed values, dependency tracking, and formula evaluation.

    Data Structure DesignData Structure DesignGraphCachingDependency Tracking
  • 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
  • Math & Bit ManipulationEasyModel answer
    Handling IEEE 754 Floating-Point Limits in JavaScript

    Understand JavaScript numeric edge cases, floating-point precision constraints, and how to safely implement custom checks without built-in helpers.

    Math & Bit Manipulationjavascriptieee-754numeric-precisiontype-coercion
  • 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