KatInterview

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

Interview Practice Problems

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

6013
Problems
2228
Auto-graded
15
Topics
273
Added today

Showing 1441–1470 of 2228 results

  • Data Structure DesignMediumAuto-graded
    Two-Way Link Mapper: Shorten and Restore URLs

    Tests ability to design a bidirectional hash map structure that assigns stable short identifiers to long URLs and retrieves originals in O(1).

    Data Structure Designhash-mapdesignstrings
  • Heaps, Sorting & SearchMediumAuto-graded
    Find a Value in a Shifted Sorted Array

    Tests whether a candidate can run a single-pass binary search on a sorted array that has been cyclically shifted by an unknown offset.

    Heaps, Sorting & Searchbinary-searcharraysdivide-and-conquer
  • Trees & GraphsMediumAuto-graded
    Largest Label Spread Across Graph Clusters

    Tests ability to find connected components in an undirected graph and compute the maximum difference between the highest and lowest node labels in any single component.

    Trees & Graphsunion-findgraphsconnected-components
  • Arrays & HashingHardAuto-graded
    Backtest a Mean-Reversion Trading System

    Tests ability to implement a complete trading backtest with entry/exit logic, transaction costs, performance metrics, train/test splits, and statistical validation.

    Arrays & Hashingbacktestingtime-seriesfinancesimulation
  • Arrays & HashingMediumAuto-graded
    Sequential Shape Placement on a Matrix

    Tests matrix manipulation, collision detection, and ordered simulation by placing fixed shapes onto a grid.

    Arrays & Hashingmatrixsimulationgreedy
  • StringsMediumAuto-graded
    Build All Balanced Bracket Sequences

    Tests recursion with constraint-based pruning to construct valid nested bracket strings without generating invalid candidates.

    Stringsrecursionbacktrackingcombinatorics
  • Arrays & HashingEasyAuto-graded
    Next Red Card: Conditional Draw Probability

    Tests conditional probability under sampling without replacement from a fixed-composition deck given observed draw history.

    Arrays & Hashingprobabilitycombinatoricsconditional-probability
  • Math & Bit ManipulationMediumAuto-graded
    Decode a Mixed-Radix Positional Number

    Tests the ability to convert a number represented in a variable base-per-digit (mixed-radix) system back to its standard base-10 integer value.

    Math & Bit Manipulationmathbase conversionnumber theory
  • StringsMediumAuto-graded
    Longest Shared Leading-Digit Sequence Between Two Integer Lists

    Tests whether a candidate can avoid brute-force pair comparison by exploiting bounded digit counts to match prefixes efficiently with a hash set.

    Stringsstringsarrayshashing
  • Arrays & HashingMediumAuto-graded
    Session-Based Account Risk Scoring with Bayesian Updates

    Tests probabilistic modeling with the Binomial distribution, Bayes' theorem, two-stage classification pipelines, and F1-optimal threshold selection in a risk-scoring context.

    Arrays & Hashingprobabilitybayes-theorembinomial-distribution
  • Arrays & HashingMediumAuto-graded
    Compute Correlation from Three Variance Values

    Tests whether a candidate can apply the variance-of-a-sum identity to extract correlation, and correctly handle the case where one variance is missing.

    Arrays & Hashingstatisticsmathprobability
  • Trees & GraphsHardAuto-graded
    Shortest Supplier Chain Between Two Vendors

    Tests BFS-based shortest-path traversal on an undirected graph, including path reconstruction and degree-of-separation counting with correct edge-case handling.

    Trees & GraphsgraphsBFSshortest-path
  • Arrays & HashingEasyAuto-graded
    Probability Inventory Covers Random Demand

    Compute the binomial CDF: the chance that at most s of n independent customers request a limited item.

    Arrays & Hashingprobabilitybinomial-distributioncombinatoricscdf
  • Arrays & HashingMediumAuto-graded
    Identify Customers With Unmet Service Needs

    Tests spatial hashing and set union logic to find customers whose required service tags are not collectively offered by any nearby vendor within a radius.

    Arrays & Hashingspatial-hashingset-operationsgrid-bucketing
  • Heaps, Sorting & SearchMediumAuto-graded
    K-th Value in a Row-and-Column Sorted Grid

    Tests binary search on value space combined with an O(n) staircase count to efficiently locate the k-th smallest element in a doubly sorted matrix.

    Heaps, Sorting & Searchbinary-searchmatrixheap
  • Data Structure DesignMediumAuto-graded
    Simulate a Bounded Cache That Forgets the Least-Used Entry

    Tests O(1) design of a fixed-size recency-ordered cache: correct eviction order, recency refresh on reads and writes, and update-without-evict semantics.

    Data Structure Designhash-maplinked-listcachedesign
  • Data Structure DesignMediumAuto-graded
    Order State Machine with Transition Validation

    Tests finite state machine implementation with strict transition rules and rejection of invalid state changes.

    Data Structure Designstate-machinevalidationdata-structures
  • StringsMediumAuto-graded
    Sum Two Large Numbers Represented as Digit Strings

    Tests manual digit-by-digit addition with carry propagation on arbitrarily large integers stored as strings.

    Stringsstring-manipulationmathsimulation
  • Dynamic ProgrammingMediumAuto-graded
    Sum of All-One Squares in a Binary Grid

    Tests dynamic programming on 2D grids by computing the total count of square submatrices containing only ones.

    Dynamic Programmingdynamic-programmingmatrices2d-dp
  • Arrays & HashingMediumAuto-graded
    K-th Missing Positive and Sliding-Window Duplicate Events

    Tests order-statistics reasoning for k-th missing positive integers and time-window frequency tracking to detect repeated log events.

    Arrays & Hashingarrayssortingsliding-window
  • Arrays & HashingEasyAuto-graded
    Repeated Values and Longest Two-Distinct Subarray

    Tests hash-based duplicate detection alongside a sliding window that finds the longest subarray containing exactly two distinct integer values.

    Arrays & Hashingsliding-windowhashingtwo-pointers
  • Data Structure DesignMediumAuto-graded
    Variable Registry With Deep Reference Expansion and Cycle Detection

    Tests recursive variable substitution with memoization, cycle detection across direct and indirect references, and clean handling of undefined variable references.

    Data Structure Designstringsrecursionhash-mapcycle-detection
  • Data Structure DesignMediumAuto-graded
    Running Median via Dual-Heap Simulation

    Tests whether a candidate can maintain a live median over an integer stream in O(log n) per insert using two heaps balanced around the midpoint.

    Data Structure Designheapsdata-structure-designonline-algorithms
  • Math & Bit ManipulationEasyAuto-graded
    Four Colleagues in a Row: Recover the Exact Standing Order

    Tests constraint satisfaction and logical deduction by finding the unique left-to-right arrangement of four people from four positional clues.

    Math & Bit Manipulationlogicconstraint-satisfactionbrute-forcepermutations
  • Arrays & HashingMediumAuto-graded
    Leftmost Busiest Slot After Range Increments

    Apply many inclusive range additions over a possibly huge array and return the index holding the largest total, breaking ties toward the smallest index.

    Arrays & Hashingdifference-arrayprefix-suminterval-updatestie-break
  • Heaps, Sorting & SearchMediumAuto-graded
    Select Up to Three Books from Distinct Genres

    Tests greedy optimization with category constraints, hash-map aggregation, and heap-based top-k selection.

    Heaps, Sorting & Searchgreedyhashmapheapoptimization
  • Stacks & QueuesHardAuto-graded
    Simulate a FIFO Queue with Two Stacks

    Tests whether you can emulate first-in-first-out ordering using only two LIFO stacks and explain the amortized cost of each operation.

    Stacks & Queuesstacksqueueamortized-analysis
  • Arrays & HashingMediumAuto-graded
    Assign Minimum Consistent Ranks to Matrix Cells

    Tests greedy assignment of ranks by processing elements in sorted order while maintaining row and column constraints.

    Arrays & Hashingsortinggreedymatrix
  • Stacks & QueuesMediumAuto-graded
    Single-Threaded CPU: Exclusive Runtimes and Stack Snapshot

    Tests stack simulation and interval reasoning by computing per-function exclusive execution time and reconstructing the active call stack at a query timestamp from a sorted event log.

    Stacks & Queuesstacksimulationinterval-reasoning
  • Arrays & HashingMediumAuto-graded
    Layer-by-Layer Matrix Traversal Without Extra Storage

    Tests boundary-tracking traversal under strict space and immutability constraints, requiring careful handling of single-row and single-column edge cases.

    Arrays & Hashingmatrixtraversalconstant-spaceboundary-tracking