KatInterview

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

Coding Interview 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 1621–1650 of 2121 results

  • 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
  • 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
  • Arrays & HashingEasyAuto-graded
    Tight Probability Bounds for the Union of Two Events

    Tests whether a candidate can derive the Fréchet bounds on P(A ∪ B) given only the marginal probabilities of two events with unspecified dependence.

    Arrays & Hashingprobabilityboundsinclusion-exclusion
  • Arrays & HashingEasyAuto-graded
    Mean Distinct Item Count Per Group

    Tests ability to deduplicate items within groups, handle null values, and compute aggregated metrics with proper rounding.

    Arrays & Hashinghash-mapsetaggregationdata-processing
  • Greedy & IntervalsMediumAuto-graded
    Collect Coins with Fixed-Jump Pieces

    Tests modular arithmetic insight and greedy reasoning to determine which resources are reachable under constrained movement rules.

    Greedy & Intervalsgreedymodular-arithmeticarrays
  • Stacks & QueuesHardAuto-graded
    Peak Tower Configuration with Height Limits

    Construct a sequence that rises then falls while respecting per-element caps, maximizing the sum using greedy peak selection and monotonic stacks.

    Stacks & Queuesmonotonic-stackgreedyprefix-sum
  • Trees & GraphsMediumAuto-graded
    Detect Cycles in a Package Dependency Graph

    Tests ability to detect cycles in a directed graph using DFS-based cycle detection, modelling package dependencies where a cycle makes installation impossible.

    Trees & Graphsgraphscycle detectiondepth-first searchtopological order
  • Dynamic ProgrammingMediumAuto-graded
    Count Tile-Filling Combinations for a Target Length

    Tests unbounded-knapsack DP by counting unordered multisets of tile widths, drawn from a given list, that sum exactly to a target corridor length.

    Dynamic Programmingdynamic-programmingcombinatoricsunbounded-knapsack
  • Arrays & HashingMediumAuto-graded
    Seven-Segment Display 180° Rotation Symmetry

    Determine if a sequence of seven-segment digits appears identical when the entire display is flipped upside down.

    Arrays & Hashingarrayssimulationmapping
  • Heaps, Sorting & SearchMediumAuto-graded
    Kth Element in Union of Two Sorted Lists

    Tests ability to find the kth smallest element from two sorted arrays using binary search on partition counts rather than merging.

    Heaps, Sorting & Searchbinary-searcharraystwo-pointers