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 2431–2460 of 2770 results

  • 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
  • Data Structure DesignMediumModel answer
    Build a Tic-Tac-Toe Game Engine with Move Validation

    Design and implement a class that tracks board state, validates moves, detects winners, and enforces turn-based gameplay for a 3×3 grid game.

    Data Structure Designstate-machinegame-logicobject-oriented-design
  • Arrays & HashingHardModel answer
    Rearrange Grid Cells into Alternating-Row Order via Adjacent Swaps

    Output a sequence of orthogonal-neighbor swaps that transforms a permuted square grid into alternating-row sorted form.

    Arrays & Hashingmatrixgreedysimulationsorting
  • 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
  • Trees & GraphsMediumModel answer
    Recursive Disk Transfer Between Three Pegs

    Move n disks from one peg to another using a spare peg, one at a time, never placing a larger disk on a smaller one.

    Trees & Graphsrecursionalgorithm-designcomplexity-analysis
  • Data Structure DesignMediumModel answer
    Scored Catalog Rotator: Ordered Traversal with Live Updates

    Design an in-memory playlist that always serves the highest-scored unseen item per round, supports live score changes, and is safe for concurrent callers.

    Data Structure Designheaptreemapconcurrencydata-structure-design
  • 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
  • Arrays & HashingMediumModel answer
    Three Algorithm Challenges: Enumeration, Backtracking, and Merging

    Solve three distinct problems: compute the k-th element in a lexicographically ordered sequence, count valid paths under geometric constraints, and merge overlapping ranges.

    Arrays & Hashingcombinatoricsbacktrackingtwo-pointersenumeration
  • 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
  • Arrays & HashingMediumModel answer
    Parallel Image Pipeline Without External Libraries

    Build a CPU-based image transformation engine that chains grayscale, brightness, and resize operations across multiple images using pure Python.

    Arrays & Hashingimage-processingparallel-processingarray-manipulation
  • 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
  • Math & Bit ManipulationMediumAuto-graded
    Convert Absolute-Value Penalty to Linear Program Constraints

    Transform a portfolio optimization model with absolute-value transaction costs into standard linear programming form using auxiliary variables.

    Math & Bit Manipulationlinear-programmingoptimizationmathematical-modeling
  • Arrays & HashingMediumAuto-graded
    Longest Subarray with Bounded Variance Sum

    Tests the ability to combine prefix sums with hash maps to efficiently find the longest contiguous subarray whose element-wise difference from the mean of two boundary values stays within a given tolerance.

    Arrays & Hashingarraysprefix sumshash maps
  • Math & Bit ManipulationMediumModel answer
    Classifying Circle Pair Relationships

    Determine whether two circles intersect at two points, are tangent at one point, or have no boundary contact.

    Math & Bit Manipulationgeometrydistanceedge-casesnumerical-stability