KatInterview

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

Coding Interview Problems

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

5995
Problems
2220
Auto-graded
15
Topics
270
Added today

Showing 1711–1740 of 2120 results

  • Trees & GraphsHardAuto-graded
    Detect File Changes Using Content-Based Tree Hashing

    Tests hierarchical hashing, tree traversal, and efficient change detection across nested directory structures

    Trees & Graphshashingtree-traversaldiff-algorithms
  • Data Structure DesignMediumAuto-graded
    Simulate Least-Recently-Used Cache Operations

    Tests your ability to implement a data structure that maintains access order and performs lookups, updates, and evictions efficiently.

    Data Structure Designhash-maplinked-listcacheordered-dict
  • Trees & GraphsMediumAuto-graded
    Largest Land Mass After One Water-to-Land Conversion

    Tests grid connected-component labeling and the ability to optimally merge adjacent island regions by flipping a single water cell to land.

    Trees & Graphsgraphbfs-dfsconnected-componentsgrid
  • Trees & GraphsMediumAuto-graded
    Smallest Valid Sequence with Dependencies

    Tests topological sorting with lexicographic tie-breaking and cycle detection in a directed graph.

    Trees & Graphstopological-sortgraphheapcycle-detection
  • Arrays & HashingMediumAuto-graded
    Puddles in a Valley: Water Volume Between Terrain Columns

    Tests whether a candidate can compute trapped water volume across a height profile using the two-pointer O(1)-space technique.

    Arrays & Hashingtwo-pointersprefix-maxarrays
  • Arrays & HashingHardAuto-graded
    Distinct Value Sum Across Peak-Score Square Ring Windows

    Tests 2D prefix sums, border enumeration, multi-way tie tracking, and cross-frame value deduplication on square ring-shaped windows of a matrix.

    Arrays & Hashing2d-prefix-summatrixsliding-window
  • Data Structure DesignMediumAuto-graded
    Contiguous Block Allocator with Tag-Based Memory Management

    Tests segment tree design for efficiently finding and tracking contiguous free blocks in a memory-like array with logarithmic-time allocation and release operations.

    Data Structure Designsegment-treeinterval-managementdata-structure-design
  • Data Structure DesignMediumAuto-graded
    Replay Operations on a Bounded LRU Cache

    Tests understanding of least-recently-used eviction by executing a sequence of cache operations and collecting their return values.

    Data Structure Designcachelruevictionsimulation
  • Arrays & HashingMediumAuto-graded
    Best Single-Breakpoint Step-Function Fit

    Tests whether a candidate can derive an O(n) prefix-aggregate sweep to find the one split index that minimizes total squared error for a two-segment constant model.

    Arrays & Hashingarraysmathprefix-sums
  • Arrays & HashingMediumAuto-graded
    Aggregate Tournament Standings from User Rankings

    Tests pairwise comparison aggregation, majority voting with tie-breaking, and ranking by win totals.

    Arrays & Hashingarrayssortingaggregation
  • Arrays & HashingEasyAuto-graded
    Neural Network Implementation of Centroid-Based Classification

    Derives the weight matrix and bias vector of a single-layer network that performs soft assignment to cluster centers using squared distance.

    Arrays & Hashingneural-networksclusteringlinear-algebra
  • StringsMediumAuto-graded
    Minimum Edit Distance to Make String a Palindrome

    Tests whether a candidate can compute the minimum number of single-character insertions needed to transform an arbitrary string into a palindrome using interval DP.

    Stringsstringsdynamic programmingpalindromesedit operations
  • Trees & GraphsMediumAuto-graded
    Resolve Variable Dependencies with Arithmetic

    Tests dependency graph traversal, cycle detection, and recursive evaluation of variables defined by arithmetic expressions.

    Trees & Graphsrecursiongraph-traversalcycle-detectionparsing
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Ranges

    Tests ability to sort intervals and merge adjacent or overlapping ranges into a minimal disjoint set.

    Greedy & Intervalsarrayssortinggreedy
  • Arrays & HashingMediumAuto-graded
    Filter Devices by Status, Threshold, and Registration Month

    Tests nested JSON navigation, timestamp parsing in UTC, date-range filtering, and numeric comparison with multiple simultaneous predicates.

    Arrays & Hashingjsondatetimefilteringdata-processing
  • Heaps, Sorting & SearchMediumAuto-graded
    Merge Sorted Streams with Memory Constraint

    Tests heap-based merging of multiple sorted sequences under strict O(k) space while maintaining stable duplicate handling.

    Heaps, Sorting & Searchheapsortingmergespace-complexity
  • StringsHardAuto-graded
    Mini Policy Engine: Boolean Rule Evaluation for Post Routing

    Tests whether a candidate can build a recursive-descent parser for a small boolean expression language and wire it into a first-match rule dispatcher.

    Stringsparsingrecursionstring processing
  • Heaps, Sorting & SearchMediumAuto-graded
    Greedy Task Merging and Segment Removal Cost

    Tests greedy heap-based merge cost minimization and prefix-sum sliding-window removal to minimize adjacent absolute differences.

    Heaps, Sorting & Searchgreedyheapprefix-sumssliding-window
  • StringsMediumAuto-graded
    Tiered Identity Validation for Business Onboarding

    Tests your ability to implement a sequential rule-engine with string normalization, token-set comparison, and strict short-circuit logic across three validation tiers.

    Stringsstringshashingsimulation
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Population Variance Using Welford's Method

    Tests ability to implement numerically stable variance computation with single-pass streaming aggregation and handling of floating-point precision issues.

    Math & Bit Manipulationmathstatisticsnumerical-stabilitystreaming
  • Math & Bit ManipulationHardAuto-graded
    Splitting Tokens: Will a Bucket Ever Run Dry?

    Tests whether a candidate can identify a modular-arithmetic invariant to avoid simulating an exponentially long process.

    Math & Bit Manipulationmathbit-manipulationnumber-theory
  • Heaps, Sorting & SearchMediumAuto-graded
    Slice a Sorted Event Stream by Timestamp Window

    Tests binary search boundary reasoning on a sorted sequence with duplicate timestamps and inclusive range semantics.

    Heaps, Sorting & Searchbinary-searcharrayssorting
  • Greedy & IntervalsMediumAuto-graded
    Peak Concurrent Tasks: Minimum Workers Needed

    Tests interval overlap detection using sweep-line or heap techniques to find the maximum number of simultaneously active tasks.

    Greedy & Intervalsintervalssortingheapsweep-line
  • Arrays & HashingMediumAuto-graded
    Shortest Subarray With All K Distinct Characters Present

    Tests ability to use a sliding window with a hash-count map to find the minimum-length contiguous subarray that contains every distinct character appearing in a string at least a given number of times.

    Arrays & Hashingarrayshash mapsliding window
  • Stacks & QueuesMediumAuto-graded
    Compute an Arithmetic Expression Honoring Operator Precedence

    Tests ability to parse and compute integer arithmetic respecting operator precedence without using eval or a full expression parser.

    Stacks & Queuesparsingoperator-precedencestack
  • StringsMediumAuto-graded
    Chunked Stream Parser and Debt Settlement

    Tests buffered string parsing over an incremental data source combined with greedy net-balance clearing across a set of financial transfers.

    Stringsstringsgreedy-intervalsdesign-ds
  • Stacks & QueuesMediumAuto-graded
    Evaluate Nested Arithmetic Brackets with Sign Propagation

    Tests expression evaluation using a monotonic/simulation stack to handle deeply nested signed bracket expressions with +/- operators and integer literals.

    Stacks & Queuesstacksexpression evaluationparsingsimulation
  • Arrays & HashingHardAuto-graded
    Computing Equilibrium Bids in Single-Item Auctions

    Tests understanding of dominant strategy equilibria in second-price auctions and Bayesian Nash equilibria in first-price auctions with uniform value distributions.

    Arrays & Hashinggame-theoryauction-theoryexpected-valuebayesian-equilibrium
  • Data Structure DesignMediumAuto-graded
    Versioned Social Graph: Follow, Snapshot, and Recommend

    Tests data-structure design for a directed follow graph with copy-on-snapshot history and friend-of-friend recommendations ranked by mutual count.

    Data Structure Designhash-mapsimulationdesign
  • Arrays & HashingHardAuto-graded
    Collect All Valid Triples in a Four-Attribute Card Game

    Tests recognition of a combinatorial validity rule across four ternary attributes and the insight that any two cards uniquely determine the third, reducing O(n³) brute force to O(n²).

    Arrays & Hashinghashingcombinatoricsmath