KatInterview

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

Coding Interview Problems

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

5987
Problems
2219
Auto-graded
15
Topics
270
Added today

Showing 1831–1860 of 2119 results

  • Arrays & HashingHardAuto-graded
    Expected Wait Time for Repeating Train Schedules

    Calculate and compare expected waiting times for transit services with different repeating gap patterns using length-biased sampling.

    Arrays & Hashingprobabilityexpected-valueinspection-paradox
  • Greedy & IntervalsMediumAuto-graded
    Optimal 1D Coverage: Minimize Worst-Case Distance to k Centers

    Tests binary-search-on-answer combined with a greedy interval feasibility check to solve the 1D k-center minimax placement problem.

    Greedy & Intervalsbinary-searchgreedysorting
  • Stacks & QueuesHardAuto-graded
    Check Balanced Brackets and Find Tree Level Width

    Tests stack-based matching for nested brackets and BFS position tracking to compute maximum horizontal distance in a binary tree.

    Stacks & Queuesstackbfstree-traversalstring-validation
  • StringsMediumAuto-graded
    Filter Files Without Write Access

    Tests string parsing and bitwise permission logic to identify files that lack write permissions across all user categories.

    Stringsstring-parsingfilteringpermissions
  • StringsMediumAuto-graded
    Maximum Distinct Character Window

    Tests sliding window technique with hash maps to find the longest contiguous span of non-repeating characters in a string.

    Stringssliding-windowhash-maptwo-pointers
  • Heaps, Sorting & SearchMediumAuto-graded
    Sort a Large Sequence Using Memory-Bounded Runs and a Heap

    Tests knowledge of two-phase external sorting: chunking a sequence into fixed-size sorted runs, then merging them efficiently with a min-heap.

    Heaps, Sorting & Searchheapsortingmergesimulation
  • Arrays & HashingMediumAuto-graded
    Detect Tic-Tac-Toe Termination on an n×n Grid

    Tests scanning all rows, columns, and diagonals for a complete line of matching non-zero marks, and detecting a full board with no remaining moves.

    Arrays & Hashingarraysmatrixgame-simulation
  • StringsEasyAuto-graded
    First Longest Word with Even Character Count

    Tests string parsing, filtering by character parity, tracking maxima with tie-breaking, and handling whitespace edge cases.

    Stringsstring-manipulationlinear-scanedge-cases
  • Greedy & IntervalsMediumAuto-graded
    Minimum Conference Rooms for Scheduled Meetings

    Tests greedy interval scheduling with heap-based resource allocation to find the smallest number of rooms needed for overlapping meetings.

    Greedy & Intervalsintervalsheapgreedyscheduling
  • Greedy & IntervalsEasyAuto-graded
    Count Rooms In Use at Peak Time

    Tests the sweep-line technique by finding the maximum number of meeting rooms simultaneously occupied across a set of half-open booking intervals.

    Greedy & Intervalsgreedysweep lineintervals
  • Trees & GraphsMediumAuto-graded
    Compute Subtree Sums from Parent Array

    Tests bottom-up aggregation in trees represented as parent arrays, requiring iterative traversal to avoid recursion limits on deep trees.

    Trees & Graphstreespost-orderaggregationiterative
  • Data Structure DesignEasyAuto-graded
    Gem Purchase Simulator with Color-Based Discounts

    Tests stateful simulation with resource tracking, discount accumulation, and transactional updates.

    Data Structure Designsimulationstate-managementhash-map
  • Stacks & QueuesHardAuto-graded
    Final Sale Prices with Discount Tracking

    Tests monotonic stack usage to efficiently find next smaller-or-equal elements and aggregate results with index tracking.

    Stacks & Queuesmonotonic-stackarraysaggregation
  • Math & Bit ManipulationMediumAuto-graded
    Anti-Diagonal Cell in Outward Spiral Matrix

    Finding a specific value in a spiral-filled matrix using mathematical properties of concentric rings rather than simulation.

    Math & Bit Manipulationmatrixspiralmathclosed-form
  • Greedy & IntervalsMediumAuto-graded
    Minimum Paint Strokes to Cover a Board

    Tests the ability to merge overlapping intervals greedily to find the fewest horizontal paint strokes needed to fully cover a set of colored segments on a 1-D board.

    Greedy & Intervalsgreedyintervalssorting
  • Math & Bit ManipulationMediumAuto-graded
    Desert Transport: Maximum Cargo Delivery with Consumption Cost

    Tests piecewise optimization and depot strategy when a vehicle with limited capacity must transport goods while consuming resources proportional to distance traveled.

    Math & Bit Manipulationoptimizationmathgreedysimulation
  • StringsMediumAuto-graded
    Maximum Substring Length with Character Limit

    Tests sliding window technique to find the longest contiguous sequence where the number of unique characters does not exceed a threshold.

    Stringssliding-windowhash-maptwo-pointers
  • Greedy & IntervalsMediumAuto-graded
    Schedule Maximum Jobs Before Their Deadlines

    Tests greedy scheduling with deadlines: select the maximum number of unit-length jobs, each with a profit and deadline, maximizing total profit within deadline slots.

    Greedy & Intervalsgreedyschedulingintervalssorting
  • Trees & GraphsHardAuto-graded
    Minimum Cost Route with Limited Layovers

    Tests understanding of constrained shortest-path algorithms on directed weighted graphs with edge-count restrictions.

    Trees & Graphsgraphsshortest-pathbellman-fordconstraints
  • Data Structure DesignHardAuto-graded
    Track the Earliest Single-Occurrence Integer in a Stream

    Design a structure that efficiently identifies the first integer appearing exactly once in a dynamic sequence of integers.

    Data Structure Designqueuehash-tabledata-structure-design
  • Arrays & HashingHardAuto-graded
    Compute P-Values for Statistical Hypothesis Tests

    Tests numerical stability in tail probability calculation, distribution function implementation, and handling of hypothesis testing edge cases.

    Arrays & Hashingstatisticsnumerical-methodshypothesis-testing
  • StringsHardAuto-graded
    Parse Token Components Without External Libraries

    Tests manual implementation of Base64URL decoding and understanding of multi-part token structure with bit-level encoding.

    Stringsencodingparsingbit-manipulation
  • Arrays & HashingMediumAuto-graded
    Find Contiguous Prefix Values in Permutation

    Tests understanding of positional reasoning and incremental range tracking in permutations to identify when values 1..k occupy consecutive indices.

    Arrays & Hashingarrayspermutationssliding-windowgreedy
  • Arrays & HashingMediumAuto-graded
    Straight-Line Word Search Across Eight Directions

    Tests whether a target word appears in a letter grid along any single unbroken ray, locking direction after the first letter.

    Arrays & Hashinggridstring-matchingenumeration
  • Trees & GraphsMediumAuto-graded
    Minimum Steps in Word Ladder

    Tests BFS on an implicit graph with efficient neighbor generation using wildcard pattern indexing.

    Trees & Graphsbfsgraphstringhashing
  • Data Structure DesignMediumAuto-graded
    Multi-Component Data Processing Challenge

    Tests array merging from the back, queue-based task scheduling with time slices, and price-level order matching in a simulated trading book.

    Data Structure Designarraysqueuessimulation
  • Data Structure DesignMediumAuto-graded
    Task Assignment System with Expiration Windows

    Tests in-memory data modeling, time-based state management, priority queuing, and handling overlapping task assignments with TTL semantics.

    Data Structure Designobject-oriented-designtime-based-logicdata-structures
  • Arrays & HashingMediumAuto-graded
    Find Minimum Window Containing All Distinct Characters

    Tests ability to use a sliding window combined with hash counting to find the shortest substring that contains every distinct character appearing in the input string.

    Arrays & Hashingsliding windowhash mapstringstwo pointers
  • Greedy & IntervalsMediumAuto-graded
    Maximum Placement with Spacing Constraints

    Tests greedy iteration with adjacency rules, requiring precise edge-case handling and index management.

    Greedy & Intervalsgreedyarraysiteration
  • Dynamic ProgrammingHardAuto-graded
    Minimum Cost to Multiply a Chain of Matrices

    Tests interval dynamic programming by finding the least expensive way to parenthesize consecutive matrix multiplications.

    Dynamic Programminginterval-dpoptimizationmemoization