KatInterview

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

Coding Interview Problems

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

6019
Problems
2229
Auto-graded
15
Topics
276
Added today

Showing 811–840 of 2128 results

  • Dynamic ProgrammingMediumAuto-graded
    Maximum Independent Set on Line and Binary Tree

    Find the maximum weight independent set for both a linear sequence and a binary tree network under non-adjacency constraints.

    Dynamic Programmingdynamic-programmingtrees-graphsarrays
  • Arrays & HashingMediumAuto-graded
    Validated Config-Driven LiDAR Scan Processor

    Validate a declarative list of crop and rigid-transform steps up front, then apply them in order to a point list while tracking metadata, without mutating the inputs.

    Arrays & Hashingsimulationvalidationmatrix-transformfiltering
  • Trees & GraphsMediumAuto-graded
    Merge Per-User Action Sequences into a Counted Prefix Tree

    Group event records by user, order each user's events by time, merge the sequences into a prefix tree with distinct-user counts, and print it in a fixed preorder format.

    Trees & Graphstriehash-mapstable-sortdfs
  • Arrays & HashingEasyAuto-graded
    Calculate Sample Size per Variant for A/B Testing

    Compute the minimum sample size required per group for a two-sample z-test given standard deviation, MDE, power, and significance level.

    Arrays & Hashingstatisticsa-b-testinghypothesis-testingmath
  • Data Structure DesignMediumAuto-graded
    Simulate a Ring Buffer Queue from a Command Log

    Replay a list of queue commands against a bounded ring buffer, returning each command's result while handling wrap-around, full and empty states correctly.

    Data Structure Designcircular-queuering-buffersimulationmodular-arithmetic
  • Heaps, Sorting & SearchMediumAuto-graded
    Generate Unique Lexicographical Permutations

    Enumerate all unique permutations of an integer list containing duplicates in lexicographically sorted order.

    Heaps, Sorting & Searcharrayssortingbacktrackingrecursion
  • Arrays & HashingMediumAuto-graded
    Fit a Line by Full-Batch Gradient Descent on Squared Error

    Implement full-batch gradient descent for a one-feature linear model, using gradients from the old parameters at every step to update the slope and intercept together.

    Arrays & Hashinggradient-descentlinear-regressionnumericalsimulation
  • Arrays & HashingEasyAuto-graded
    Static Array Range Sum Queries

    Process a sequence of range sum queries on an immutable array efficiently using prefix sums.

    Arrays & Hashingarraysprefix-sumdata-structures
  • Trees & GraphsMediumAuto-graded
    Perform Connected Component Recolor on Grid

    Perform a flood-fill recoloring on a 2D integer grid while avoiding call stack overflow and preserving the original input.

    Trees & Graphsbfs-dfsmatrixflood-fillgraph-traversal
  • Arrays & HashingMediumAuto-graded
    Survey Click-Through and Score Averages from Impression Logs

    Group survey impression records to compute a click rate, a plain score average, and an average of each user's earliest score per survey, with careful handling of missing values.

    Arrays & Hashinghash-mapgroupingsortingnull-handling
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Bookings in a Weekly Schedule

    Parse weekday and 24-hour time strings, then merge touching or overlapping same-day bookings and output them in a canonical, sorted string format.

    Greedy & Intervalsintervalssortingstring-parsingmerge-intervals
  • Dynamic ProgrammingMediumAuto-graded
    Cheapest Right-and-Down Route Across a Cost Map

    Compute the minimum total cost of a route through a rectangular cost grid using only right and down moves, which tests 2D dynamic programming with a space optimization.

    Dynamic Programmingdynamic-programminggridmatrixoptimization
  • Trees & GraphsMediumAuto-graded
    Evaluate Variable Expressions with Dependencies

    Evaluate symbolic variable definitions with standard arithmetic precedence, resolving variable dependencies while detecting cycles and missing definitions.

    Trees & Graphstrees-graphsstacks-queuestopological-sortrecursion
  • Trees & GraphsEasyAuto-graded
    Largest Cluster of Two-Digit Numbers Linked by Common Digits

    Find the largest connected cluster in a list of two-digit numbers where links come from shared digits, testing graph connectivity modeling with union-find or digit-hub nodes.

    Trees & Graphsunion-findconnected-componentsbitmaskgraph
  • Trees & GraphsMediumAuto-graded
    Shortest Grid Path to Nearest Fulfillment Hub

    Find the minimum travel distance from every destination point to its closest source hub on a 2D grid using multi-source Breadth-First Search.

    Trees & GraphsBFSMulti-Source BFSGrid TraversalShortest Path
  • Math & Bit ManipulationMediumAuto-graded
    Determine if Two Coin Stacks Can Be Equalized by Doubling

    Determine if two initial quantities can reach equality through deterministic transfers that double the recipient stack.

    Math & Bit Manipulationmath-bitsnumber-theorybit-manipulationsimulation
  • Dynamic ProgrammingMediumAuto-graded
    Minimum Containers for Target Volume

    Find the minimum combination of reusable containers to reach an exact target total volume, or return None if impossible.

    Dynamic Programmingdynamic-programmingunbounded-knapsackbacktracking
  • StringsMediumAuto-graded
    Find Minimum Substring with K Distinct Characters

    Determine the length of the shortest contiguous substring that contains a target count of unique lowercase letters using a sliding window technique.

    Stringssliding-windowstringstwo-pointershash-table
  • Data Structure DesignEasyAuto-graded
    Replay Keyed Updates and Report Per-Group Peak Values

    Simulate a log of keyed insert and query commands, keeping a running maximum for each key so single-key and all-key peak queries are answered without rescanning data.

    Data Structure Designhash-mapsimulationrunning-maximumdesign
  • Dynamic ProgrammingHardAuto-graded
    Maximum Non-Adjacent Node Value Sum in Binary Tree

    Find the maximum total node sum from a binary tree represented as a level-order list such that no two selected nodes share a parent-child edge.

    Dynamic Programmingtrees-graphsdynamic-programmingarrays
  • Trees & GraphsMediumAuto-graded
    Minimum Steps Across a Square Maze with Diagonal Moves

    Tests breadth-first search on a square binary grid with eight-directional moves, handling blocked endpoints, visited tracking, and counting cells along the shortest route.

    Trees & Graphsbfsgridshortest-pathgraph-traversal
  • Greedy & IntervalsMediumAuto-graded
    Subscription Windows: Purchase Attribution and Anomaly Report

    Merge each user's subscription intervals, then attribute purchases to the merged windows, count September active days, and report out-of-window and overlap anomalies.

    Greedy & Intervalsintervalsmerge-intervalshash-mapdatetime
  • Heaps, Sorting & SearchHardAuto-graded
    Gift Card Waterfall, ZIP Surcharges and Refund Credits

    Simulate a stream of purchase and refund events that drain gift cards by expiry priority, surcharge the card remainder by ZIP range, and turn excess refunds into store credit.

    Heaps, Sorting & Searchsimulationheappriority-queuebinary-search
  • Trees & GraphsMediumAuto-graded
    Sparse Vector Overlap Sum and Land Cluster Counter

    Combine a merge-style sparse vector dot product with an iterative flood fill that counts 4-connected land clusters, returning both results together.

    Trees & Graphstwo-pointerssparse-vectorgriddfs
  • Data Structure DesignMediumAuto-graded
    Execute Sequence of LRU Cache Instructions

    Simulate a Least Recently Used (LRU) cache supporting fast lookups, insertions, updates, and capacity evictions across a series of operations.

    Data Structure Designhash-tabledoubly-linked-listdesign
  • Dynamic ProgrammingMediumAuto-graded
    Count Grid Walkways Without Three Consecutive Steps

    Count valid grid paths composed of horizontal and vertical steps such that no direction is repeated three times in a row.

    Dynamic Programmingdynamic-programminggridcombinatoricsmemoization
  • Data Structure DesignMediumAuto-graded
    Serialize and Split Key-Value Store Payload

    Encodes a dictionary mapping string keys to string values into a binary protocol payload and splits it into fixed-size byte chunks.

    Data Structure Designencodingbinarystringsdesign-ds
  • Data Structure DesignEasyAuto-graded
    Replay a Command Script and Record Box State After Each Step

    Simulate an ordered list of color, delay and move commands on a box, tracking cumulative position and total waited time, and return a state snapshot after every command.

    Data Structure Designsimulationstate-machinearraysmethod-chaining
  • Math & Bit ManipulationEasyAuto-graded
    Rent and Occupancy Targets for a 100-Unit Apartment Building

    Apply a simple profit model with fixed costs, a rent-proportional cost and a target return to find a required rent and a required occupancy.

    Math & Bit Manipulationmathbreak-evenunit-economicsalgebra
  • Trees & GraphsMediumAuto-graded
    Minimum Web Page Hop Distance

    Find the shortest distance between two web pages in a directed link graph using breadth-first search.

    Trees & Graphsbfsgraphshortest-pathtrees-graphs