KatInterview

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

Coding Interview Problems

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

5980
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 2551–2580 of 2765 results

  • Data Structure DesignMediumModel answer
    Text Editor with Undo and Word Suggestions

    Build a text editor class supporting character insertion, deletion, cursor movement, undo/redo operations, and prefix-based word autocompletion.

    Data Structure Designdata-structurestrieundo-redogap-buffer
  • Math & Bit ManipulationMediumAuto-graded
    Maximum Theater Group Seating Capacity

    Tests bitmask-based interval availability checking for constrained seat allocation with large input optimization.

    Math & Bit Manipulationbitmaskgreedyoptimization
  • Trees & GraphsMediumAuto-graded
    Subtree Sum Replacement in Level-Order Arrays

    Tests post-order traversal, heap indexing in complete binary trees, and efficient bottom-up aggregation without recursion.

    Trees & Graphsbinary-treespost-order-traversalcomplete-binary-treeaggregation
  • Data Structure DesignHardAuto-graded
    Streaming Median Query

    Tests balanced heap design to maintain dynamic order statistics with logarithmic insertions and constant-time median queries.

    Data Structure Designheapsdata-structuresstreamingmedian
  • Arrays & HashingHardAuto-graded
    Random Transfer Between Two Queues: Drain Time and Odds

    Tests ability to model a lazy symmetric random walk as a Markov chain, derive a closed-form hitting-time formula, and compute absorption probabilities analytically.

    Arrays & Hashingmarkov-chainsrandom-walkprobability
  • Trees & GraphsHardAuto-graded
    Earliest Moment a Social Network Becomes Fully Connected

    Tests offline dynamic graph connectivity using a segment-tree-over-time with a rollback-capable union-find to handle both edge insertions and deletions.

    Trees & Graphsunion-findsegment-treedynamic-connectivity
  • Heaps, Sorting & SearchEasyAuto-graded
    Minimum Largest Piece After K Cuts on a Log

    Tests binary search on the answer to find the minimum possible largest piece when splitting a log into at least K+1 pieces.

    Heaps, Sorting & Searchbinary searchgreedysorting
  • Dynamic ProgrammingMediumAuto-graded
    Pack Exactly K Items with Maximum Total Value

    Tests the candidate's ability to apply a 2D knapsack variant requiring exactly a fixed item count while maximizing value, combining count and capacity constraints via DP.

    Dynamic Programmingdynamic programmingknapsack2d dp
  • Heaps, Sorting & SearchMediumAuto-graded
    Count Active Users in Trailing Time Window

    Tests binary search on sorted lists to efficiently count distinct entities with at least one event in a sliding time range.

    Heaps, Sorting & Searchbinary-searchtime-seriessliding-window
  • Arrays & HashingMediumAuto-graded
    Balance and Settle Shared Costs

    Tests the ability to calculate net balances from shared expense records and generate transfers that zero out all debts.

    Arrays & Hashinghash-mapgreedysimulation
  • Data Structure DesignMediumModel answer
    Parallel Job Scheduler with Dependency Management

    Build a concurrent task executor that honors dependencies, enforces worker limits, and propagates failures through dependent jobs.

    Data Structure Designconcurrencygraphstopological-sort
  • Data Structure DesignMediumModel answer
    Frequency Tracking with Static and Streaming Top-K Retrieval

    Build data structures to identify the most frequent elements in three scenarios: a fixed array, an unbounded stream, and a time-windowed stream.

    Data Structure Designfrequency-countingheapssliding-windowstreaming-algorithms
  • Data Structure DesignMediumAuto-graded
    Billing Ledger with Credit Prioritization and Backdating

    Process billing events where credits pay usage before subscription fees, supporting out-of-order event insertion with selective recomputation.

    Data Structure Designdata-structuressimulationordered-data
  • StringsMediumAuto-graded
    Minimum Window with K Distinct Characters

    Tests sliding window technique with character frequency tracking to find the smallest substring containing exactly k distinct characters.

    Stringssliding-windowhash-maptwo-pointers
  • Trees & GraphsMediumAuto-graded
    Schedule Tasks With Resource Unlock Dependencies

    Tests ability to apply topological ordering to determine a valid execution sequence of tasks where each task may unlock resources required by others.

    Trees & Graphsgraphstopological sortDAGKahn's algorithm
  • Greedy & IntervalsMediumAuto-graded
    Locate Uncovered Ranges Between Intervals

    Tests interval merging, sorting, and boundary logic to identify all missing integer ranges within the overall coverage span.

    Greedy & Intervalsintervalssortingmergingranges
  • StringsMediumModel answer
    Remove Paths by Prefix Hierarchy

    Remove all paths that match or fall under any deletion target in a hierarchical filesystem-like structure.

    Stringstrieprefix-matchingstring-processing
  • Data Structure DesignMediumModel answer
    In-Memory Payroll Tracker with Partial Settlement

    Build an object-oriented service to log driver work intervals, compute wages, and process payments while preventing double-pay and handling overlaps.

    Data Structure Designobject-oriented-designtime-intervalsmoney-arithmeticstate-management
  • Arrays & HashingMediumAuto-graded
    Balance Point Count in a Weighted Sensor Array

    Tests the ability to use prefix sums to efficiently count indices where the weighted sum to the left equals the weighted sum to the right.

    Arrays & Hashingarraysprefix sumshash maps
  • Heaps, Sorting & SearchEasyAuto-graded
    Running Median After Each Insertion

    Tests median maintenance using two heaps to efficiently return the running median after each element is added to a growing sequence.

    Heaps, Sorting & Searchheapssortingmedian maintenance
  • Arrays & HashingMediumAuto-graded
    Maximum Straight-Line Distance Through Dangerous Zones

    Tests efficient grid reasoning with blocked regions and directional movement constraints using binary search.

    Arrays & Hashingbinary-searchgridgeometry
  • Arrays & HashingMediumAuto-graded
    Keep First Occurrence of Each Element

    Tests understanding of hash-based deduplication while maintaining insertion order in a single pass through an array.

    Arrays & Hashingarrayshash-setdeduplicationorder-preservation
  • Data Structure DesignMediumAuto-graded
    Time-Aware Key-Field Store with Expiration

    Tests ability to implement an in-memory store with nested key-field structure, lexicographic scanning, timestamps, and TTL-based expiration logic.

    Data Structure Designhash-mapsimulationtime-based-expiration
  • Trees & GraphsMediumAuto-graded
    Aggregate User Permissions Through Account Ancestry

    Tests hierarchical graph traversal and efficient permission accumulation using ancestor path lookup and set operations.

    Trees & Graphsgraphstreesbfscaching
  • Trees & GraphsMediumAuto-graded
    Calculate Cumulative Task Weights in a Dependency Graph

    Tests graph traversal and dynamic programming on DAGs to compute propagated weight contributions through dependency chains.

    Trees & Graphsgraphsdagtopological-sortdynamic-programming
  • Trees & GraphsMediumAuto-graded
    Rank Build Targets by Dependency Order

    Tests whether a candidate can produce a valid topological ordering of a build-dependency DAG and apply a precise tie-break rule when multiple orderings exist.

    Trees & Graphsgraphstopological sortBFSKahn's algorithm
  • Trees & GraphsHardAuto-graded
    Fastest Delivery Route with Fuel Station Stops

    Tests the ability to extend Dijkstra's algorithm with a constrained resource (fuel), requiring candidates to track both position and remaining fuel as state.

    Trees & Graphsgraphsdijkstrashortest pathdynamic programming
  • Dynamic ProgrammingHardAuto-graded
    Construct Arithmetic Expression Matching Target

    Tests subset enumeration with bitmask DP, binary expression tree generation, operator application with exact rational arithmetic, and combinatorial search.

    Dynamic Programmingbitmask-dprecursioncombinatorics
  • Trees & GraphsHardModel answer
    Navigate Between Nodes in a Recursively Defined Binary Tree

    Determine the path between two nodes in a Fibonacci-style binary tree using only their preorder indices, without building the tree in memory.

    Trees & Graphsbinary-treesrecursionfibonaccitree-traversal
  • Trees & GraphsMediumAuto-graded
    Identify Connected Power Grid Regions

    Tests union-find (disjoint set union) to group transmission lines into connected components and answer queries about grid connectivity.

    Trees & Graphsunion-findgraphsconnected-components