KatInterview

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

Coding Interview Problems

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

6049
Problems
2239
Auto-graded
15
Topics
272
Added today

Showing 1381–1410 of 2793 results

  • Trees & GraphsMediumAuto-graded
    Words Traced Through a Letter Board

    Find every dictionary word that can be traced through orthogonally adjacent cells of a letter board without reusing a cell, using backtracking guided by a prefix tree.

    Trees & Graphsbacktrackingtriedfsgrid
  • Arrays & HashingEasyAuto-graded
    Earliest Non-Repeating Event Name in a Sequence

    Find the earliest entry in a list of strings that occurs exactly once overall, or return an empty string, testing frequency counting combined with preserved order.

    Arrays & Hashinghash-mapcountingstringstwo-pass
  • Data Structure DesignMediumAuto-graded
    Admit or Deny Requests Under a Per-Client Rolling Quota

    Process a time-ordered request log and decide per request whether a client is under its quota in a rolling time window, counting only previously admitted requests.

    Data Structure Designsliding-windowdequehash-mapsimulation
  • Arrays & HashingEasyAuto-graded
    Locate the Two Positions That Add Up to a Goal Value

    Find the single pair of distinct positions in an integer list whose values add up to a goal, using a one-pass lookup instead of checking every pair.

    Arrays & Hashinghash-maparraycomplement-lookup
  • Greedy & IntervalsMediumAuto-graded
    Fewest Conference Rooms for a Day of Bookings

    Compute the minimum number of rooms needed to host all time-range bookings when back-to-back bookings may reuse a room, testing sweep-line or heap-based interval reasoning.

    Greedy & Intervalsintervalsheapsweep-linesorting
  • Heaps, Sorting & SearchMediumAuto-graded
    Leftmost Match in a Sorted Sequence Without a Known Size

    Find the first index of a target in a sorted list while the search pretends its length is unknown, using doubling probes followed by a lower-bound binary search.

    Heaps, Sorting & Searchbinary-searchexponential-searchduplicatessorted-array
  • Stacks & QueuesMediumAuto-graded
    Largest Block Under a Skyline of Columns

    Compute the largest rectangle that fits under a row of unit-width columns, testing monotonic stack usage and boundary reasoning over contiguous ranges.

    Stacks & Queuesmonotonic-stackarrayhistogramcontiguous-range
  • Trees & GraphsMediumAuto-graded
    Nearest Exit Distance Map on a Walled Grid

    Compute, for every open cell of a grid with walls and exits, the shortest 4-directional distance to any exit using multi-source BFS, leaving unreachable cells unchanged.

    Trees & Graphsbfsgridmulti-source-bfsmatrix
  • Greedy & IntervalsMediumAuto-graded
    Fewest Drivers to Cover Every Trip Without Overlap

    Find the fewest drivers needed to serve all trips given [start, end) times, which reduces to the peak number of simultaneous trips and tests sweep-line or heap handling of boundaries.

    Greedy & Intervalsintervalssweep-lineheapgreedy
  • Arrays & HashingEasyAuto-graded
    Per-Row Offset From Group Average in a Record List

    Tests group-then-broadcast logic: compute each group's mean over a list of dict records, then attach each row's difference from its group mean while preserving order.

    Arrays & Hashinghash-mapgroup-byaggregationsimulation
  • Greedy & IntervalsMediumAuto-graded
    Find the First Free Slot After Busy Minutes in Text Schedules

    Parse text schedule entries into inclusive minute intervals, merge them, and find the earliest k-minute free slot that follows the first busy minute of the day.

    Greedy & Intervalsintervalsmerge-intervalsstring-parsingsorting
  • Data Structure DesignMediumModel answer
    Resilient Chargeback Inbox: Normalize, Cache, and Cancel in React

    Build a React dispute list that normalizes inconsistent API data, caches queries for 60 seconds, and avoids stale responses when filters or search change quickly.

    Data Structure Designreacttypescriptcachingrace-conditions
  • Trees & GraphsMediumAuto-graded
    Service Inventory Filter and Dependency Risk Report

    Filter a service inventory by namespace, attributes and status, then compute transitive dependencies and risk flags from a root service, handling cycles and dangling references.

    Trees & Graphsgraph-traversaldfshash-mapfiltering
  • StringsMediumAuto-graded
    Fewest Source Slices to Spell a Target

    Find the minimum number of source substrings whose concatenation equals the target, using longest-match-per-position and a greedy jump pass.

    Stringsstringsgreedysuffix-automatontwo-pointers
  • Trees & GraphsMediumAuto-graded
    Shortest Route to an Exit with Fixed Direction Priority

    Run BFS on a character grid to return the shortest move sequence to any exit, breaking ties by a fixed U, D, L, R direction priority.

    Trees & Graphsbfsgridshortest-pathpath-reconstruction
  • Math & Bit ManipulationEasyAuto-graded
    Lamps After Divisor Sweeps

    Count how many of n switches end up on after sweeping by every step size, which tests the divisor-parity and perfect-square insight.

    Math & Bit Manipulationmathnumber-theoryperfect-squaresdivisors
  • Dynamic ProgrammingMediumAuto-graded
    Counting Valid Ordered Binary Trees on n Labeled Nodes

    Count the distinct binary search trees on keys 1..n by splitting on the root and combining independent subtree counts with dynamic programming.

    Dynamic Programmingdynamic-programmingcombinatoricsbinary-search-treecatalan-numbers
  • Math & Bit ManipulationHardAuto-graded
    Can a Starting Pair Grow Into a Goal Pair by Summing Coordinates?

    Decide whether a goal pair is reachable from a start pair by replacing one coordinate with the sum of both, using a reverse walk with Euclid-style modulo jumps for values up to 10^9.

    Math & Bit Manipulationmatheuclidean-algorithmreverse-thinkingmodulo
  • Stacks & QueuesMediumAuto-graded
    Rebuild an Outline Tree from Depth-Tagged Lines

    Turn a flat sequence of (depth, label) entries into a nested tree by attaching each entry to its nearest earlier entry with a smaller depth, using a monotonic stack.

    Stacks & Queuesstacktree-constructionparsingmonotonic-stack
  • Math & Bit ManipulationHardAuto-graded
    Fewest Presses to Morph One Light Grid Into Another

    Find the smallest set of cell presses that turns one on/off grid into another, where each press flips a cell and its neighbours. Tests GF(2) elimination and null-space minimisation.

    Math & Bit Manipulationgaussian-eliminationgf2bitmasklinear-algebra
  • Arrays & HashingEasyAuto-graded
    Filter Events per Subscriber with Named Rules

    Apply an ordered list of named filter rules to every user-event pair and build a per-user list of qualifying event ids, handling missing prices, empty rule lists and unknown rule names.

    Arrays & Hashinghash-mapsimulationfilteringstrategy-pattern
  • Arrays & HashingEasyAuto-graded
    Leftmost Column Containing a One in Row-Sorted Grid

    Find the leftmost column holding a 1 in a binary grid whose rows are sorted, aiming for a linear-time walk instead of scanning every cell.

    Arrays & Hashingmatrixtwo-pointersbinary-matrixstaircase-search
  • Arrays & HashingMediumAuto-graded
    Weekly Power-User Share per Country from Impression Logs

    Group impression records by country and user over a 7-day window, flag users with 4+ active dates and 3+ surfaces on one date, and report per-country percentages.

    Arrays & Hashinghash-mapgroupingsetsdate-handling
  • Data Structure DesignHardModel answer
    Eagerly Cached Cell Grid with Dependency Tracking

    Build a grid of cells that stores integers or sum formulas, keeps every value precomputed for constant-time reads, and refuses any write that would introduce a circular reference.

    Data Structure Designgraphtopological-sortcycle-detectioncaching
  • Data Structure DesignEasyModel answer
    Layered Scopes for a Key-Value Store with Savepoints

    Build an in-memory key-value store whose writes can be grouped into nested, revertable scopes that either merge into the enclosing scope or are thrown away.

    Data Structure Designstackhash-mapdesignscoping
  • Trees & GraphsMediumAuto-graded
    Best Island Total with Row-Major Boundary Cells

    Find connected components in a signed grid and pick the best-scoring one, with and without a no-negatives rule, reporting its first and last row-major cells.

    Trees & Graphsgriddfsconnected-componentstie-breaking
  • Data Structure DesignMediumModel answer
    Run Work Items on Manual Python Threads and Debug Them in Linux

    Fan a function out over a list using a fixed number of hand-made Python threads, capture every result or error, join cleanly, then inspect the live threads from the Linux shell.

    Data Structure Designpythonthreadingconcurrencylinux
  • Data Structure DesignMediumAuto-graded
    Live Ranking Board for Sponsored Listings

    Process a batch of insert, delete and top-k operations on scored items, keeping a live ranking with in-place score updates and deterministic tie-breaking.

    Data Structure Designheaphash-maplazy-deletiondesign
  • Data Structure DesignEasyAuto-graded
    Ledger Replay: Deposits, Withdrawals and Percentage Rewards

    Simulate a single account balance across a sequence of operations, silently rejecting invalid ones, and report the balance after each step.

    Data Structure Designsimulationstate-managementvalidationfloating-point
  • Trees & GraphsMediumAuto-graded
    Costliest Root Task in a Task Forest

    Sum durations over each root's subtree in a parent-linked record list and return the root with the largest total, testing tree aggregation and iterative traversal.

    Trees & Graphstreedfshash-mapiterative-traversal