KatInterview

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

Coding Interview Problems

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

5991
Problems
2219
Auto-graded
15
Topics
270
Added today

Showing 2371–2400 of 2770 results

  • Arrays & HashingMediumAuto-graded
    Subarrays with Odd Zero Frequency

    Tests understanding of prefix parity tracking and combinatorial counting to efficiently solve subarray problems.

    Arrays & Hashingprefix-sumtwo-pointersmath
  • Trees & GraphsMediumAuto-graded
    Filter Users by Active Connection Threshold

    Tests graph maintenance with dynamic edge insertion and deletion, proper handling of duplicates and missing edges, and final degree counting.

    Trees & Graphsgraphshash-tablesimulation
  • StringsMediumAuto-graded
    Minimum Edit Distance Between Two Palindromes

    Tests understanding of edit distance (insert, delete, substitute) by computing the minimum operations needed to transform one palindrome into another, reinforcing dynamic programming on strings.

    Stringsstringsdynamic programmingedit distancepalindromes
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Weight in a Nested Balanced Mobile System

    Tests systematic application of balance constraints in a multi-level mobile where equal-arm bars divide weight evenly.

    Math & Bit Manipulationalgebrarecursionmathlogic
  • Greedy & IntervalsMediumAuto-graded
    Combine Overlapping Intervals

    Tests interval merging through sorting and linear scanning, focusing on edge-case handling for touching and nested ranges.

    Greedy & Intervalsintervalssortingarrays
  • Trees & GraphsMediumAuto-graded
    Minimum-Length Root-to-Leaf Path with Target Sum

    Tests tree traversal with state tracking to identify the shortest valid path satisfying a sum condition.

    Trees & Graphsbinary-treedfspath-finding
  • Math & Bit ManipulationEasyAuto-graded
    Digital Root via Modular Arithmetic

    Tests understanding of modular arithmetic by computing the digital root of a large integer without repeatedly summing digits in a loop.

    Math & Bit Manipulationmathmodular arithmeticnumber theory
  • Data Structure DesignMediumModel answer
    Area-Weighted Random Point Sampling Across Multiple Squares

    Design a class for uniform random point sampling inside a square, then extend it to sample uniformly from the union of N non-overlapping squares.

    Data Structure Designprobabilityprefix-sumssamplinggeometry
  • Trees & GraphsMediumAuto-graded
    Signal Propagation Time to All Destinations

    Tests understanding of multi-source BFS to compute the longest shortest path from any source to all required destinations on a grid with obstacles.

    Trees & Graphsbreadth-first-searchgridmulti-source-bfsshortest-path
  • Arrays & HashingHardAuto-graded
    Survey Gender Distribution Probability

    Compute probabilities of observing specific gender counts in survey samples under binomial and hypergeometric models.

    Arrays & Hashingprobabilitystatisticscombinatorics
  • Arrays & HashingHardAuto-graded
    Classify Queries by Nearest Reference After Linear Transform

    Tests vectorized linear projection, pairwise distance computation, and nearest-neighbor selection with tie-breaking.

    Arrays & Hashingmatrix-operationsdistance-metricsvectorization
  • Arrays & HashingMediumAuto-graded
    Count Contiguous Segments Summing to K

    Tests efficient subarray counting using prefix sum differences tracked in a hash map.

    Arrays & Hashingprefix-sumhash-mapsubarray
  • Arrays & HashingMediumAuto-graded
    Four Utility Functions: Crop, Softmax, Gaussian, Triangle

    Tests array slicing, numerical stability in exponential calculations, 2D kernel generation, and geometric inequality validation in a single bundled function.

    Arrays & Hashingmathnumerical-methodsgeometry
  • Data Structure DesignHardModel answer
    Build an Idempotent Financial Account System

    Create an in-memory account manager that enforces balance rules, prevents duplicate processing via transaction IDs, and detects conflicting retries.

    Data Structure Designfinancial-systemsidempotencydata-structuresstate-management
  • Heaps, Sorting & SearchHardAuto-graded
    Build a Min-Heap and Schedule Tasks by Priority

    Construct a working min-heap from scratch, then apply it to schedule dependent tasks in lexicographic order while detecting cycles.

    Heaps, Sorting & Searchheaptopological-sortgraphdata-structures
  • Data Structure DesignHardAuto-graded
    Time-Versioned Key-Value Storage

    Implement a data structure that stores versioned values by timestamp and retrieves the most recent version at or before a query time.

    Data Structure Designbinary-searchhash-mapdata-structures
  • Data Structure DesignMediumAuto-graded
    Process Account Transaction Sequence

    Tests ability to implement stateful operations on indexed data with validation, edge-case handling, and multiple operation types.

    Data Structure Designsimulationvalidationstate-management
  • Trees & GraphsMediumModel answer
    Weighted Grid Navigation: Minimum Cost Path Around Walls

    Find the cheapest path through a cost-weighted grid containing impassable walls, returning the total cost and route, or -1 if no path exists.

    Trees & Graphsdijkstrapriority-queueshortest-pathgrid
  • Data Structure DesignHardModel answer
    Design a Thread-Safe Resource Pool with RAII Handles

    Build a concurrent object pool in C++ that safely manages reusable resources with blocking acquisition, automatic return via RAII, and graceful shutdown.

    Data Structure Designconcurrencyc++raiithread-safety
  • Math & Bit ManipulationMediumAuto-graded
    Balanced Digit Sum Across All Bases

    Tests understanding of base conversion by summing digits of a number across every base from 2 to b and checking whether each base yields a digit sum equal to a target value.

    Math & Bit Manipulationmathbit manipulationbase conversion
  • Data Structure DesignMediumAuto-graded
    Compute Dot Products for Memory-Efficient Integer Vectors

    Tests efficient sparse data representation using hash maps and optimizing operations by focusing on non-zero elements only.

    Data Structure Designhash-mapsparse-dataoptimization
  • StringsEasyAuto-graded
    Count Distinct Words in a Sentence

    Tests the ability to tokenize a raw sentence string into normalized word tokens and count how many distinct words appear exactly once.

    Stringsstringstokenizingparsing
  • Heaps, Sorting & SearchMediumAuto-graded
    Minimize the Maximum Delivery Time Across Routes

    Tests binary search on the answer combined with greedy feasibility checking to minimize the maximum delivery time when assigning parcels to couriers.

    Heaps, Sorting & Searchbinary searchgreedysorting
  • StringsEasyAuto-graded
    Count Distinct Morse Code Representations

    Tests string encoding with a fixed mapping, hashing for deduplication, and understanding that identical encodings can arise from different inputs.

    Stringshash-setstring-manipulationencoding
  • Greedy & IntervalsMediumAuto-graded
    Maximum Concurrent Reservations

    Calculate the peak number of overlapping time intervals to determine minimum resource capacity.

    Greedy & Intervalsintervalssweep-linesorting
  • Trees & GraphsMediumAuto-graded
    Lowest Shared Ancestor in Organization Hierarchy

    Finding the deepest node that lies on the upward path to the root for all given employees in a tree structure.

    Trees & Graphstreelowest-common-ancestordepth-first-searchbreadth-first-search
  • Data Structure DesignMediumModel answer
    Call Channel State Manager

    Build a stateful manager that allows exactly one active two-party call at a time, with proper validation and error handling.

    Data Structure Designstate-machineobject-oriented-designvalidationexceptions
  • Data Structure DesignHardAuto-graded
    Simulate a TTL-Aware LFU Cache with Frequency Snapshots

    Tests ability to simulate a multi-operation Least-Frequently-Used cache that evicts expired entries by TTL and breaks ties by recency, while supporting frequency-snapshot queries.

    Data Structure Designdata structurescachesimulation
  • Arrays & HashingHardAuto-graded
    Coin Flip Race: HHT vs HTH Probability and Conditional Wait

    Tests whether you can set up a Markov chain for a pattern race, derive absorption probabilities, and compute a conditional expected stopping time.

    Arrays & Hashingmarkov-chainsprobabilityexpected-value
  • Linked ListsMediumAuto-graded
    Interleave Two Linked Lists from Their Midpoints

    Tests pointer-manipulation reasoning by reordering a singly linked list (given as an array) so nodes alternate between the first and second halves, starting from their respective midpoints.

    Linked Listslinked liststwo pointersarray manipulation