KatInterview

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

Coding Interview Problems

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

6035
Problems
2235
Auto-graded
15
Topics
274
Added today

Showing 1081–1110 of 2134 results

  • 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
  • Dynamic ProgrammingMediumAuto-graded
    Longest Shared Block After Removing One Character

    Find the longest block shared with a second string after optionally deleting one character from the first, using an O(n*m) DP with a deletion-used state.

    Dynamic Programmingdynamic-programmingstringslongest-common-substring
  • Data Structure DesignMediumAuto-graded
    Nested Message Schema: Size and Field Type Queries

    Parse a mini protobuf-style schema from text, then answer batched size and field-type queries with nested messages, forward references, and cycle and error handling.

    Data Structure Designparsinghash-maprecursionmemoization
  • Trees & GraphsMediumAuto-graded
    Best Conversion Product Over Simple Currency Paths

    Find the largest product of edge weights over simple directed paths between two nodes, using backtracking DFS, with a special case for identical endpoints and an unreachable case.

    Trees & Graphsgraphdfsbacktrackingsimple-paths
  • StringsMediumAuto-graded
    Find a Block Repeated Back-to-Back in a Token List

    Decide whether a list of tokens contains a block of a given length repeated a given number of times in a row, testing period detection with a linear scan.

    Stringsstringsarrayssliding-windowperiodicity
  • Trees & GraphsMediumAuto-graded
    Net Access Letters Across a Dependency Hierarchy

    Compute each node's final letter set in a DAG where grants flow to all descendants but revocations apply only to the node that declares them.

    Trees & Graphsgraphdagtopological-sortbitmask
  • Data Structure DesignEasyAuto-graded
    Sorted Buffer Simulator with Insert and Snapshot Commands

    Simulate a container that keeps integers in ascending order under insert and snapshot commands, testing binary-search insertion, duplicate handling, and copying versus aliasing.

    Data Structure Designbinary-searchsimulationsorted-listdesign
  • Arrays & HashingMediumAuto-graded
    Shortest Block to Cut for a Non-Decreasing Remainder

    Find the shortest contiguous block whose removal leaves a non-decreasing array, using sorted prefix/suffix boundaries and two pointers, with a smallest-start tie-break.

    Arrays & Hashingtwo-pointersarraysprefix-suffixgreedy
  • Math & Bit ManipulationEasyAuto-graded
    Smallest Equicorrelation Value for a Valid 3x3 Matrix

    Determine the least real parameter for which a 3x3 symmetric matrix with unit diagonal and equal off-diagonal entries is positive semidefinite, using eigenvalue or minor analysis.

    Math & Bit Manipulationlinear-algebraeigenvaluespositive-semidefinitemath
  • Arrays & HashingMediumAuto-graded
    Cross-Array Pair Sum Check on Two Ordered Lists

    Decide whether one value from each of two sorted lists adds up to a target, using a linear-time opposite-direction two-pointer scan with constant extra space.

    Arrays & Hashingtwo-pointerssorted-arraystwo-sumoverflow-safety
  • Arrays & HashingEasyAuto-graded
    Horvitz-Thompson Event Rate from Weighted Inspection Records

    Estimate a population-wide event rate from samples drawn with known unequal inclusion probabilities, using inverse-probability weighting divided by the population size.

    Arrays & Hashinginverse-probability-weightingsamplingestimationhorvitz-thompson
  • Arrays & HashingMediumAuto-graded
    Rover on a Walled Floor Plan with Blocked Cells

    Simulate a rover on a bounded rectangular grid that turns, steps forward, and steps backward, skipping any step that leaves the grid or enters a blocked cell.

    Arrays & Hashingsimulationhash-setgridmodular-arithmetic
  • Greedy & IntervalsMediumAuto-graded
    Stock Piles Priced by Remaining Count: Maximum Earnings

    Greedy selling from the largest pile, solved in bulk with sorting and arithmetic-series sums because the number of sales is too large to simulate one by one.

    Greedy & Intervalsgreedysortingarithmetic-seriesmath
  • Arrays & HashingMediumAuto-graded
    Balanced Alternating Sums After One Removal

    Count positions whose removal makes the sum at even positions equal the sum at odd positions, testing prefix/suffix sums and the parity shift after a deletion.

    Arrays & Hashingprefix-sumsparityarraycounting
  • Data Structure DesignMediumAuto-graded
    Dual-Quota Request Throttle with Sliding Time Window

    Simulate a throttle that enforces a per-user and a per-game quota over a sliding time window, recording a request only when both quotas have room.

    Data Structure Designsliding-windowdequehash-mapsimulation
  • Trees & GraphsMediumAuto-graded
    Batch Ratio Lookup Over Linked Quantities

    Answer many ratio queries between named quantities from pairwise ratio facts, using a weighted union-find or component precomputation instead of a search per query.

    Trees & Graphsunion-findgraphweighted-union-findbatch-queries
  • Arrays & HashingEasyAuto-graded
    Category Revenue and Fulfillment Report from Three Tables

    Join order, product and category records, group by category name, and compute total revenue, mean revenue per row and the share of completed rows, using hash maps.

    Arrays & Hashinghash-mapaggregationjoingrouping
  • StringsMediumAuto-graded
    Build an expression from 1 to 9 that hits a target

    Tests depth-first backtracking over operator choices, on-the-fly evaluation without re-parsing, and deterministic tie-breaking when several valid answers exist.

    Stringsbacktrackingdfsrecursionstring-construction
  • Heaps, Sorting & SearchEasyAuto-graded
    Clean, Impute and Rank Student Score Records

    Filter records with too many missing values, fill gaps with per-subject medians, then pick the top five using a multi-key sort with tie-breaks.

    Heaps, Sorting & Searchsortingmediandata-cleaningsimulation
  • Data Structure DesignMediumAuto-graded
    Bidirectional Walk Over a CIDR Block's Addresses

    Simulate a two-way cursor over the IPv4 addresses of a CIDR block using integer arithmetic, with exact boundary and no-move-on-failure rules.

    Data Structure Designiteratorbit-manipulationcidrsimulation
  • Arrays & HashingMediumAuto-graded
    Card Authorization Report with Time-Activated Block Rules

    Sort card authorization events by time and apply permanent, time-activated block rules to label each as APPROVE or REJECT, testing stable sorting, two-stream merging and hashing.

    Arrays & Hashinghashingsortingsimulationtwo-pointers
  • Data Structure DesignMediumAuto-graded
    Count Lower Readings in a Trailing Time Window

    Simulate a sequence of record and query operations over a timestamped stream, counting readings in a trailing window that are strictly lower than the latest reading.

    Data Structure Designsliding-windowbinary-searchsimulationstreaming
  • Heaps, Sorting & SearchMediumAuto-graded
    Gini Split Search Plus One Regression Gradient Step

    Sweep sorted feature values to find the lowest weighted-Gini binary split, and apply one MSE gradient descent update for linear regression.

    Heaps, Sorting & Searchsortingprefix-sweepgini-impuritygradient-descent
  • Trees & GraphsMediumAuto-graded
    Largest Chain Reaction From a Single Detonation

    Model one-way blast reach as a directed graph and find the largest set reachable from any single starting node, using exact integer distance checks.

    Trees & Graphsgraphdfsreachabilitygeometry
  • Trees & GraphsMediumAuto-graded
    Find the Exit of a Keyed Forest Graph

    Run a breadth-first search over (location, keys held) states in a forest with locked doors to find the first exit reached, or None.

    Trees & Graphsbfsgraphstate-space-searchparsing
  • Greedy & IntervalsMediumAuto-graded
    Collapse Overlapping Time Ranges Into Disjoint Blocks

    Sort closed integer ranges and sweep once to combine any that overlap or touch, returning the minimal ordered list of disjoint ranges.

    Greedy & Intervalsintervalssortingsweepgreedy
  • Trees & GraphsMediumAuto-graded
    Column Grid from a Tree: Reach a Value by Walking Non-Zero Cells

    Project a heap-indexed binary tree onto a depth-by-column grid, then use BFS over non-zero cells to decide whether a cell holding the target is reachable from a given start.

    Trees & Graphsbinary-treebfsgridvertical-order
  • Stacks & QueuesMediumAuto-graded
    Unnest Deeply Nested Lists Without Recursion

    Flatten an arbitrarily nested Python list into a single list in left-to-right order, treating only lists as containers and handling very deep nesting safely.

    Stacks & Queuesstackiterationnested-listsdepth-first-search
  • Trees & GraphsMediumAuto-graded
    Eager Formula Sheet with Cycle-Safe Updates

    Simulate a mini spreadsheet where formulas are evaluated at write time, dependents update eagerly, and any write that would create a dependency cycle is rejected without changing state.

    Trees & Graphsdependency graphtopological sortcycle detectionsimulation
  • Trees & GraphsMediumAuto-graded
    Duplicate a Nested Structure With Cycles and Shared Parts

    Build an independent deep copy of a nested container structure, preserving shared references and cycles, using a memo table and an explicit stack.

    Trees & Graphsdeep-copygraph-traversalmemoizationiterative-dfs