KatInterview

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

Coding Interview Problems

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

6025
Problems
2231
Auto-graded
15
Topics
273
Added today

Showing 901–930 of 2130 results

  • Trees & GraphsMediumAuto-graded
    Best Net Reward Route to an Underscore Node in a DAG

    Find the highest net score of a route in a weighted DAG that ends at a node whose name starts with an underscore, using topological order and DP.

    Trees & Graphsgraphdagtopological-sortdynamic-programming
  • Data Structure DesignMediumAuto-graded
    Identify Winning Move in Bottom-Inserted Drop Game

    Simulate a custom grid game with bottom-insertion pushes to detect the earliest turn that forms a line of length k.

    Data Structure Designarrayshash-tablesimulationdesign-ds
  • Arrays & HashingEasyAuto-graded
    Reverse Array Segment Between First Two Target Occurrences

    Reverse the subsegment of an array from the first occurrence of a target value up to its second occurrence.

    Arrays & Hashingarraystwo-pointersslicing
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Expected Score from Multi-Stage Die Rerolls

    Computes the optimal decision threshold and overall expected payoff when given one optional reroll on an N-sided die.

    Math & Bit Manipulationmathprobabilityexpected-valuedynamic-programming
  • Math & Bit ManipulationEasyAuto-graded
    Determine Animal Quantities in a Barn

    Find the integer count of each animal species given the total legs and proportional species constraints.

    Math & Bit Manipulationmathalgebra
  • Stacks & QueuesMediumAuto-graded
    Rounds of Pruning in a Garden Row

    Count how many rounds of simultaneous removals occur in a row of numbers where each element larger than its left neighbor is removed, using a monotonic stack to beat quadratic simulation.

    Stacks & Queuesmonotonic-stacksimulationarraysamortized-analysis
  • Math & Bit ManipulationMediumAuto-graded
    Maximize Disjoint Letter Coverage

    Find the maximum count of distinct letters that can be collected by picking a mutually disjoint subset of strings.

    Math & Bit Manipulationbit-manipulationbacktrackingdynamic-programmingstrings
  • Trees & GraphsMediumAuto-graded
    Common Ancestor of Two Values, Only If Both Exist

    Find the lowest common ancestor of two values in a level-order encoded binary tree, returning null when either value is missing from the tree.

    Trees & Graphsbinary-treelowest-common-ancestorparent-mapbfs
  • Trees & GraphsMediumAuto-graded
    Maximum Subtree Weight for Every Node in a Network

    Find the maximum sum of a connected component containing each node in an undirected tree using dynamic programming with rerooting.

    Trees & Graphstrees-graphsdynamic-programmingtree-dprerooting-dp
  • Arrays & HashingMediumAuto-graded
    Runners on a Road Frozen by a Sweeping Guard

    Simulate runners advancing along a road while a guard turns at given seconds and freezes anyone in view, using parity of duplicate turn times and strict event ordering.

    Arrays & Hashingsimulationhash-mapcountingparity
  • Stacks & QueuesMediumAuto-graded
    Widest Span Between Two Dominating Ends

    Find the longest subarray whose two end values are each strictly larger than everything between them, using a monotonic stack to avoid checking all pairs.

    Stacks & Queuesmonotonic-stackarraysnearest-greateramortized-analysis
  • StringsEasyAuto-graded
    Fill In Percent-Delimited Tokens From a Lookup Table

    Scan a string left to right, replacing each %key% token with its mapped value and returning None when a key is missing; tests careful linear string parsing.

    Stringsstringsparsinghash-maptwo-pointers
  • Greedy & IntervalsMediumAuto-graded
    Insert and Merge Interval into Sorted Collection

    Incorporate a target range into an already sorted list of disjoint closed intervals, merging any overlapping or adjacent spans in linear time.

    Greedy & Intervalsintervalsarraysgreedy
  • Data Structure DesignMediumAuto-graded
    Replay a Bounded Recency Store from an Operation Log

    Simulate a fixed-size store that discards its stalest entry on overflow, answering lookups in O(1) each by pairing a hash map with a doubly linked list.

    Data Structure Designhash-mapdoubly-linked-listlru-cachesimulation
  • Heaps, Sorting & SearchMediumAuto-graded
    Where Is the Traveler? Locate by Timestamp from Trip Logs

    Answer timestamp queries against unsorted trip intervals using sorting and binary search, handling closed boundaries, gaps between trips, and times before the first trip.

    Heaps, Sorting & Searchbinary-searchsortingintervalssimulation
  • Arrays & HashingEasyAuto-graded
    Push Zeros Left While Keeping Other Values in Order

    Rearrange an integer list in place so all zeros come first and the non-zero values keep their original relative order, using a right-to-left two-pointer pass.

    Arrays & Hashingarraystwo-pointersin-place
  • Arrays & HashingMediumAuto-graded
    Four-Position Target Sum Finder Preserving Original Indices

    Find all increasing index quadruples whose values add up to a target, treating equal values at different positions as distinct answers; tests hashing pair sums and ordering.

    Arrays & Hashinghash-mapmeet-in-the-middlek-sumindices
  • Math & Bit ManipulationEasyAuto-graded
    Simulate Account Transactions with Integer Cashbacks

    Process a series of deposits, conditional withdrawals, and integer floor cashbacks to compute a final account balance.

    Math & Bit Manipulationsimulationmatharrays
  • Trees & GraphsMediumAuto-graded
    Referral Credit Ledger with Multilevel Propagation

    Simulate account additions, referral bonus propagation (direct or indirect), and threshold queries ordered deterministically.

    Trees & Graphstrees-graphsarraysdesign-ds
  • Trees & GraphsMediumAuto-graded
    BFS Unweighted Shortest Path with Ancestor Tracking

    Perform breadth-first traversal on an unweighted graph to compute shortest distances and record parent pointers for path reconstruction.

    Trees & Graphsbfsgraph-traversalshortest-pathqueue
  • Trees & GraphsMediumAuto-graded
    Lightest Downward Path in a Level-Order Tree

    Find the root-to-leaf path with the smallest value sum in a tree given as a level-order list, breaking ties toward the left, without recursion on 100,000-node skewed trees.

    Trees & Graphsbinary-treedfsiterative-traversalprefix-sum
  • Heaps, Sorting & SearchMediumAuto-graded
    Select the k Most Common Values with Tie Rules

    Count value frequencies and pick the k most frequent values, using a bounded heap and a defined tie-break rule for equal counts.

    Heaps, Sorting & Searchheaphash-mapfrequency-countingtop-k
  • Heaps, Sorting & SearchEasyAuto-graded
    Adjacent Entries Lookup in a Sorted Catalog

    Answer batched queries on a sorted list of unique IDs by binary searching for each target and returning its adjacent values, or nulls when the target is absent.

    Heaps, Sorting & Searchbinary-searchsorted-arraybisectbatch-queries
  • Heaps, Sorting & SearchEasyAuto-graded
    Locate Gap in Sorted Consecutive Sequence

    Detect a missing entry in a sorted contiguous array of integers in logarithmic time using binary search.

    Heaps, Sorting & Searcharraysbinary-search
  • Greedy & IntervalsMediumAuto-graded
    Find the Maximum Size Connected Interval Component

    Find the maximum number of intervals that belong to a single connected component where edges represent inclusive interval overlaps.

    Greedy & Intervalsintervalssortinggreedygraphs
  • Greedy & IntervalsEasyAuto-graded
    Split Chores Between Two Workers With a Fixed Quota

    Choose exactly k items for the first worker to maximize total payoff, which tests reducing a problem to per-item differences and greedy top-k selection.

    Greedy & Intervalsgreedysortingarraysexchange-argument
  • Arrays & HashingEasyAuto-graded
    Softmax-Weighted Value Mixing for Query Rows

    Implement scaled dot-product attention on nested lists using a numerically stable softmax and a weighted average of value rows.

    Arrays & Hashingmatrixsoftmaxnumerical-stabilityattention
  • Arrays & HashingEasyAuto-graded
    Find the Modal Number, Smallest on a Tie

    Tests frequency counting with a hash map and a deterministic numeric tie-break, returning the value itself without altering the input list.

    Arrays & Hashinghash-mapcountingtie-breaking
  • Data Structure DesignMediumAuto-graded
    Run a Command Log on a Recency Cache with Live Mean

    Simulate a fixed-capacity least-recently-used cache from a command log, answering lookups and the mean of stored values, each in expected constant time.

    Data Structure Designlru-cachehash-mapdoubly-linked-listrunning-sum
  • StringsMediumAuto-graded
    Every Window of Length Three or More Must Be a Known Word

    Check that every contiguous substring of length at least 3 appears in a word list, testing set-based lookups, loop bounds and the vacuous case for short strings.

    Stringsstringshash-setsubstringsenumeration