KatInterview

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

Interview Practice Problems

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

6000
Problems
2221
Auto-graded
15
Topics
272
Added today

Showing 1681–1710 of 2221 results

  • Trees & GraphsHardAuto-graded
    Prune All Leaves Matching a Value, Cascading Upward

    Tests whether a candidate can use post-order traversal to handle cascading leaf deletions in a binary tree encoded as a level-order list.

    Trees & Graphsbinary-treepost-order-traversalrecursiontree-serialization
  • Heaps, Sorting & SearchMediumAuto-graded
    K Nearest Points to Origin

    Tests heap-based selection and distance computation to efficiently find the k points closest to the origin in 2D space.

    Heaps, Sorting & Searchheapdistanceselectionoptimization
  • Data Structure DesignMediumAuto-graded
    Binary Layout Manager with Dynamic Field Insertion

    Tests ability to maintain ordered sequences with efficient prefix-sum queries and positional insertions using balanced tree structures.

    Data Structure Designbinary-search-treeprefix-sumdata-structure-design
  • Trees & GraphsMediumAuto-graded
    Subtree Erasure in an Array-Backed Binary Tree

    Tests implicit heap-tree traversal, subtree identification via index arithmetic, and stable compaction without mutating the input array.

    Trees & Graphstrees-graphsarraysbfs-dfs
  • Arrays & HashingEasyAuto-graded
    Best-of-Five: Probability All Five Games Are Played

    Tests whether a candidate can derive the closed-form probability that a best-of-five series requires all five games, using combinatorial reasoning.

    Arrays & Hashingprobabilitycombinatoricsmath
  • Arrays & HashingEasyAuto-graded
    Expected Coin Flips to Observe Heads Then Tails

    Tests ability to model a probabilistic process with states and solve expectation equations.

    Arrays & Hashingprobabilityexpected-valuemarkov-chains
  • Data Structure DesignMediumAuto-graded
    Priority Queue Scheduler + Expression Evaluator

    Tests heap-based priority scheduling with tie-breaking and recursive-descent expression parsing with variable substitution.

    Data Structure Designheapparsingdesign
  • Arrays & HashingMediumAuto-graded
    Sample Mean: Expected Value and Variance Under Correlation

    Tests ability to compute the expected value and variance of a sample mean when observations share a common correlation, plus limiting behavior in boundary cases.

    Arrays & Hashingstatisticsprobabilityexpected-valuevariance
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Time Ranges

    Tests whether a candidate can sort and scan a list of closed intervals to collapse all overlapping or touching ranges into a minimal merged set.

    Greedy & Intervalsintervalssortinggreedy
  • Math & Bit ManipulationMediumAuto-graded
    Count Subsequences With Uniform Letter Frequency

    Tests combinatorics, modular arithmetic, and frequency grouping by counting index-distinct subsequences where every included letter appears the same number of times.

    Math & Bit Manipulationcombinatoricsmodular arithmeticfrequency counting
  • Heaps, Sorting & SearchMediumAuto-graded
    Find K Closest Elements in Sorted Array

    Tests binary search on sorted arrays to locate a contiguous window of k elements with minimum distance to a target value.

    Heaps, Sorting & Searchbinary-searchtwo-pointerssliding-window
  • Data Structure DesignMediumAuto-graded
    Rate Limiter with Bucket Drain Simulation

    Tests ability to model a rate-limiting algorithm with time-based decay, capacity bounds, and precise edge-case handling.

    Data Structure Designrate-limitingsimulationstate-machine
  • Arrays & HashingHardAuto-graded
    Find All Contiguous Segments with Target Total

    Tests prefix sum tracking with hash maps to efficiently count all contiguous subsequences that sum to a target value.

    Arrays & Hashingprefix-sumhash-maparray
  • Greedy & IntervalsMediumAuto-graded
    Minimum Classrooms to Schedule All Lectures

    Tests whether a candidate can reframe a resource-allocation problem as peak interval overlap and handle half-open boundary conditions correctly.

    Greedy & Intervalsintervalssweep-linegreedysorting
  • Stacks & QueuesMediumAuto-graded
    Compute Arithmetic Expression with Operator Precedence

    Tests parsing and evaluating mathematical expressions with proper operator precedence and parentheses using stack-based techniques.

    Stacks & Queuesstacksexpression-parsingoperator-precedence
  • Data Structure DesignMediumAuto-graded
    Simulate a Cache with Recency-Based Eviction

    Tests data structure design by building an in-memory cache that removes the least recently accessed entry when full.

    Data Structure Designhash-maplinked-listcacheeviction-policy
  • Data Structure DesignMediumAuto-graded
    Count-Weighted Random Sampling with Dynamic Insertions and Removals

    Design a multiset supporting constant-time insert, remove, and random selection where each element's pick probability is proportional to its frequency.

    Data Structure Designhash-maparraysrandomizationdata-structure-design
  • Arrays & HashingEasyAuto-graded
    Daily-Deal Voucher: Restaurant Profit & Break-Even Analysis

    Tests whether you can build a contribution-margin model for a voucher partnership, solve break-even and sensitivity equations, and decompose a profit change into its drivers.

    Arrays & Hashingunit economicscontribution marginbreak-even analysis
  • Trees & GraphsMediumAuto-graded
    Minimum Hops Between Nodes in a Matrix-Represented Graph

    Tests ability to implement BFS on an undirected unweighted graph stored as an adjacency matrix to find the fewest edges between two nodes.

    Trees & Graphsgraphsbfsadjacency-matrix
  • Trees & GraphsMediumAuto-graded
    Minimum Collections to Link Two Items

    Tests bipartite graph traversal and BFS to find shortest paths alternating between items and their containing collections.

    Trees & Graphsgraph-theorybfsbipartite-graph
  • Data Structure DesignMediumAuto-graded
    Simulate a Stack with Instant Maximum Access

    Tests data structure design skills by building a stack that supports O(log n) max retrieval and removal, including removal from the middle when duplicates exist.

    Data Structure Designstackheaplinked-listlazy-deletion
  • Greedy & IntervalsMediumAuto-graded
    Fill a Cargo Hold for Maximum Value With Limited Item Supply

    Tests whether a candidate can recognize that a bounded knapsack with uniform item weight reduces to a greedy sort-and-fill, handling large capacities and stock counts efficiently.

    Greedy & Intervalsgreedysortingbounded-knapsack
  • Data Structure DesignMediumAuto-graded
    Execute Banking Operations with Transaction History

    Tests command-pattern operation execution, input validation, atomic state transitions, and maintaining per-entity audit logs.

    Data Structure Designsimulationvalidationstate-management
  • Stacks & QueuesMediumAuto-graded
    Concert Venue Ticketing with Capacity and a Waiting Line

    Tests event-driven simulation skills: tracking visitor state, enforcing a seating capacity, managing a FIFO waitlist, and collecting one-time entry fees.

    Stacks & Queuessimulationqueuehash-set
  • Data Structure DesignMediumAuto-graded
    Build a Multi-User File System with Quotas and Compression

    Design an in-memory file manager tracking per-user storage limits, file operations, pattern matching, and size adjustments with atomic quota enforcement.

    Data Structure Designhash-tablessimulationdesign
  • Dynamic ProgrammingHardAuto-graded
    Count Sorted Sequences Matching Per-Position Digit Sums

    Tests dynamic programming over value buckets with a two-pointer prefix-sum transition to count sorted integer sequences under a digit-sum constraint.

    Dynamic Programmingdynamic-programmingarraysmath-bits
  • StringsMediumAuto-graded
    Highest Frequency Letter with Alphabetical Tie-Breaking

    Tests efficient character frequency counting and consistent tie-breaking using fixed-size auxiliary space.

    Stringsstringsarraysfrequency-counting
  • Math & Bit ManipulationMediumAuto-graded
    Longest Non-Overlapping Character Chain

    Tests backtracking or bitmask optimization to select a subset of strings whose combined characters are all distinct.

    Math & Bit Manipulationbacktrackingbit-manipulationrecursion
  • SQL & DataEasyAuto-graded
    Co-Access Analytics on Document Usage Logs

    Tests data deduplication, self-joins, metric definition, and grouped aggregation over access logs with user metadata.

    SQL & Datadata-manipulationaggregationjoinsdeduplication
  • StringsMediumAuto-graded
    Fix a Row-to-CSV Converter: Output Correctness and Efficiency

    Tests whether a candidate can spot a trailing-comma output bug and a quadratic string-building performance problem, then write a correct, efficient fix.

    Stringsstringsperformancejoins