KatInterview

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

Interview Practice 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 1231–1260 of 2232 results

  • Trees & GraphsMediumAuto-graded
    Smallest Job Schedule Under Dependency Rules

    Produce the lexicographically smallest topological ordering of a dependency graph, or an empty list if the dependencies contain a cycle.

    Trees & Graphstopological-sortgraphheapcycle-detection
  • Arrays & HashingMediumAuto-graded
    Users Needed Per Group for a Two-Proportion Test

    Compute the smallest equal group size for a two-sided two-proportion z-test, given a baseline rate, relative uplift, significance level and target power.

    Arrays & Hashingstatisticssample-sizepower-analysisab-testing
  • StringsMediumAuto-graded
    Longest Repeated-Letter Block With a Limited Rewrite Budget

    Find the longest block of identical letters obtainable by rewriting at most k characters, testing sliding-window reasoning on majority counts for strings up to 100,000 characters.

    Stringssliding-windowstringstwo-pointershashing
  • Arrays & HashingMediumAuto-graded
    Window Sums Within [k, 2k] for Power-of-Two Lengths

    Enumerate every subarray whose length is a power of two and whose sum falls in [k, 2k], using prefix sums to get an O(n log n) solution with ordered output.

    Arrays & Hashingprefix-sumsliding-windowsubarrayenumeration
  • Arrays & HashingMediumAuto-graded
    Deterministic Mini-Batch Gradient Descent for a Line Fit

    Fit a slope and intercept to 2D points by running deterministic mini-batch gradient descent on mean squared error, with exact batching, update order and edge-case rules.

    Arrays & Hashinggradient-descentlinear-regressionmini-batchoptimization
  • Greedy & IntervalsMediumAuto-graded
    Coalesce Touching Segments and Measure Coverage

    Merge half-open integer segments that overlap or touch end-to-start, then report the merged segments in order along with their combined covered length.

    Greedy & Intervalsintervalssortingsweepmerge
  • Arrays & HashingMediumAuto-graded
    Rank Among Values Occurring Once Across Two Lists

    Count occurrences across two combined lists, keep values seen exactly once, and return the k-th largest of them or -1 if there are fewer than k.

    Arrays & Hashinghash-mapcountingsortingheap
  • Trees & GraphsMediumAuto-graded
    Balance Path Totals in a Rooted Tree with Minimum Bumps

    Compute the fewest +1 increments that make every root-to-leaf path total equal in a large rooted tree given as a parent array, which needs a bottom-up greedy and an iterative traversal.

    Trees & Graphstreegreedybfstree-dp
  • Arrays & HashingMediumAuto-graded
    Fill a Padded Sorted Buffer from a Second Sorted List

    Merge two sorted lists into the first, which has trailing spare slots, without extra memory; tests back-to-front two-pointer merging.

    Arrays & Hashingtwo-pointersin-placesortingmerge
  • Data Structure DesignMediumAuto-graded
    Rolling Forklift Ping Counts with Late Arrivals and Shift Tracking

    Simulate a fleet telemetry service that tracks per-forklift pings in a global 15-minute window, handles late pings, and counts clocked-in forklifts.

    Data Structure Designsliding windowheaphash mapdata structure design
  • Arrays & HashingEasyAuto-graded
    Bump a Digit-Array Number Up by One

    Increment a large non-negative number stored as a digit list by one, handling carry propagation and length growth without converting to an integer.

    Arrays & Hashingarrayscarrysimulationmath
  • SQL & DataMediumAuto-graded
    Variant-Level Tutorial Finish Rate Within a One-Week Window

    Join users to step events, cap each user's progress at a 7-day window, infer each variant's final step, and compute per-variant completion shares.

    SQL & Datahash-mapaggregationdatetimecohort-analysis
  • Data Structure DesignEasyAuto-graded
    Bidirectional Page Navigation with Integer Cursors

    Simulate a paginator that serves pages forward and backward from integer cursors, with correct clamping at both ends and for a short final page.

    Data Structure Designdesignpaginationsimulationarray-slicing
  • Stacks & QueuesMediumAuto-graded
    Validate Balanced Round, Square and Curly Brackets

    Decide whether a string of three bracket kinds is balanced, testing last-in-first-out matching with a stack and handling crossings and leftover or stray brackets.

    Stacks & Queuesstackstringsparsingbracket-matching
  • Data Structure DesignMediumAuto-graded
    Quota-Based Storage Service Simulator with Snapshots

    Simulate a command stream on a storage service with per-user quotas, ownership transfer, prefix-based top-n listing, and per-user snapshot and restore.

    Data Structure Designdesignhash-mapsimulationsorting
  • Math & Bit ManipulationEasyAuto-graded
    Dice Duel Wager: Expected Profit and Play Decision

    Compute the expected profit of a two-dice wager where ties favor the opponent, and decide whether a risk-neutral player should accept it.

    Math & Bit Manipulationprobabilityexpected-valuemathdice
  • Math & Bit ManipulationEasyAuto-graded
    Five Quick Probability Puzzles: Dice, Deck, Coins, Boxes

    Work out five small probability puzzles using symmetry, complements, counting and pigeonhole, and return the exact answers as fraction strings in order.

    Math & Bit Manipulationprobabilitycombinatoricspigeonholesymmetry
  • Trees & GraphsMediumAuto-graded
    Course Plan Builder with Already-Passed Classes

    Build a valid course order from prerequisite pairs while skipping passed courses, using a topological sort with a fixed tie-break order and cycle detection.

    Trees & Graphstopological-sortgraphbfscycle-detection
  • Data Structure DesignMediumAuto-graded
    Snapshot-based key-value store with checkpoint and reload

    Simulate a key-value store that serializes its full contents on checkpoint and replaces live state on reload, testing state management and round-trip serialization.

    Data Structure Designdesignserializationkey-value storestate management
  • Math & Bit ManipulationEasyAuto-graded
    Sales Volume Needed to Hold Margin After a Menu Expansion

    Derive a closed-form sales volume that keeps profit margin unchanged after adding a second product with extra fixed costs, and reject unreachable targets.

    Math & Bit Manipulationmathalgebrabreak-evenprofit-margin
  • Arrays & HashingMediumAuto-graded
    Probability Toolkit: Gamble Moments, Dice, Arrivals, Odds, Draws

    Compute expected value and variance, a dice conditional probability, a Poisson tail, betting edge with Kelly sizing, and a without-replacement card probability in one function.

    Arrays & Hashingprobabilityexpected-valueconditional-probabilitypoisson
  • Arrays & HashingEasyAuto-graded
    Rolling window totals over filtered records in input order

    Tests filtering a list of tagged records and computing rolling window totals in O(n) using an incremental sum instead of recomputing each window.

    Arrays & Hashingsliding-windowprefix-sumfilteringarrays
  • Greedy & IntervalsMediumAuto-graded
    Locate the Lowest-Indexed Room That Can Fit a Meeting

    Tests interval overlap checks under half-open semantics and using binary search on sorted, disjoint bookings to find a free room quickly.

    Greedy & Intervalsintervalsbinary-searchsortinghalf-open-ranges
  • Stacks & QueuesEasyAuto-graded
    Nested Delimiter Checker for Config Expressions

    Checks whether a string of mixed parentheses, braces, and square brackets is properly nested, testing stack-based matching and early rejection in linear time.

    Stacks & Queuesstackparsingstringmatching
  • Arrays & HashingMediumAuto-graded
    Detect a Run of Two or More Elements Summing to a Multiple of k

    Tests prefix-sum reasoning with hashing: detecting a contiguous run of length at least two whose sum is divisible by k, including the k = 0 special case.

    Arrays & Hashingprefix sumhash mapremainderssubarray
  • Data Structure DesignMediumAuto-graded
    LRU Cache Simulator with Recency and Grouped Views

    Simulates an LRU cache through a sequence of put, get, and snapshot operations, testing recency bookkeeping, eviction, and ordered grouping of values.

    Data Structure DesignLRU cacheOrderedDicthash mapsimulation
  • Data Structure DesignMediumAuto-graded
    Batch Simulation of an Expiring LRU Key-Value Store

    Replay a batch of timestamped get and set operations against a fixed-capacity store that combines per-key expiry with least-recently-used eviction.

    Data Structure Designhash maplinked listLRU cachesimulation
  • Greedy & IntervalsMediumAuto-graded
    Count Active Ranges at Query Points

    Tests whether a candidate can efficiently count how many inclusive ranges cover each of a set of query values using binary search decomposition.

    Greedy & Intervalsbinary-searchintervalssorting
  • Math & Bit ManipulationEasyAuto-graded
    Factorial Trailing Zeros Without Building the Factorial

    Count the base-10 trailing zeros of n! by tallying factors of 5, never constructing the enormous factorial itself.

    Math & Bit Manipulationmathnumber-theoryfactorialcounting
  • StringsMediumAuto-graded
    Interleave Characters from String Ends

    Rebuild a string by alternately picking characters from opposite ends until all are consumed, testing two-pointer convergence logic.

    Stringstwo-pointersstring-manipulationarray