KatInterview

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

Coding Interview Problems

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

6041
Problems
2237
Auto-graded
15
Topics
275
Added today

Showing 1561–1590 of 2790 results

  • 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
  • Stacks & QueuesMediumModel answer
    Evaluate Prize-Pool Formulas with Strictly Positive Whole Steps

    Parse and evaluate an infix arithmetic string, rejecting it with False if any intermediate result is zero, negative, or a non-integer quotient.

    Stacks & Queuesparsingrecursive-descentexpression-evaluationvalidation
  • Greedy & IntervalsMediumModel answer
    Busiest Stretches of a Garage from Gate Scanner Records

    Use unsorted gate scan records to find peak car occupancy and the maximal time windows at that peak, including when some exit scans are missing and stays are capped.

    Greedy & Intervalssweep-lineintervalsevent-processingsorting
  • 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
  • Trees & GraphsMediumModel answer
    Count All Valid 4×4 Three-in-a-Row Game Sequences

    Use recursion and backtracking to enumerate every ordered move sequence on a 4×4 board where three consecutive marks (not four) wins.

    Trees & Graphsbacktrackingrecursiongame-treecombinatorics
  • Dynamic ProgrammingMediumAuto-graded
    Fewest Coins to Form Target Sum

    Tests dynamic programming with unbounded resources to compute the minimal coin count for a target value, handling impossible cases.

    Dynamic Programmingdynamic-programmingcoin-changeoptimization
  • Arrays & HashingHardAuto-graded
    Maximize Total Distinct Values Across Two Arrays

    Tests greedy reasoning, frequency counting, and backtracking search to maximize the combined distinct-value count across two arrays given a limited swap budget.

    Arrays & Hashingbacktrackinggreedyfrequency-counting
  • Linked ListsMediumAuto-graded
    Walking Both Ways to Measure a Doubly Linked Chain

    Given neighbor links for a group of disjoint chains, count how many nodes sit in the chain containing a given start node.

    Linked Listslinked-listtraversaltwo-pointerssimulation
  • Heaps, Sorting & SearchMediumModel answer
    Minimum-Distance Depot Placement on a Grid with Blocked Cells

    Place a depot on a 2D integer grid to minimize total Manhattan distance to all warehouses, avoiding any cell occupied by an obstacle.

    Heaps, Sorting & Searchmanhattan-distancemedianpriority-queueprefix-sums