KatInterview

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

Coding Interview Problems

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

6019
Problems
2229
Auto-graded
15
Topics
276
Added today

Showing 1921–1950 of 2782 results

  • Arrays & HashingMediumAuto-graded
    Grid Sentinels: Match Robots by Barrier Distance Profile

    Tests efficient 2-D prefix sweeps to compute each robot's nearest-wall distance in four directions and filter by an exact profile query.

    Arrays & Hashingmatrixprefix-scansimulation
  • Greedy & IntervalsMediumModel answer
    First Open Meeting Window Across All Employees

    Sweep merged busy intervals to find the earliest gap of a required duration that fits within every employee's working hours.

    Greedy & Intervalsintervalsheapmergescheduling
  • Arrays & HashingMediumAuto-graded
    Find Most Common Elements Without Built-in Max

    Tests manual maximum-finding across a frequency dictionary, tie-breaking by first occurrence, and working with stringified keys.

    Arrays & Hashinghash-mapfrequency-countingiteration
  • Data Structure DesignHardAuto-graded
    Exact-Phrase Lookup Across a Document Collection

    Tests building a positional inverted index so that multi-word phrases can be found by exact word sequence across many documents with repeated queries handled efficiently.

    Data Structure Designinverted-indexstring-searchhashing
  • Dynamic ProgrammingHardAuto-graded
    Build Arithmetic Expressions That Hit a Target Value

    Tests backtracking with incremental precedence-aware evaluation to enumerate all +/* expressions over a number sequence that sum to a given target.

    Dynamic Programmingbacktrackingrecursionoperator-precedence
  • Data Structure DesignMediumModel answer
    Build a Bounded In-Memory File System with Auto-Rename

    Design a trie-backed file system supporting path-based file insertion and directory listing, with a per-directory capacity cap and OS-style duplicate renaming.

    Data Structure Designtriehash-mapfile-systemOOP
  • Data Structure DesignMediumModel answer
    Build an Expiry-Aware LRU Cache Without Scanning Every Key

    Design an in-memory cache that enforces capacity with LRU eviction and per-entry TTL, keeping expiration efficient without iterating all keys.

    Data Structure Designcachelruttlconcurrency
  • Data Structure DesignMediumModel answer
    Order Book Simulator with Fair Volume Participation

    Build a limit order matching engine, then add participation-rate execution logic for one client, and finally extend to multiple clients with fair allocation.

    Data Structure Designorder-bookpriority-queuesimulationgreedy
  • Trees & GraphsMediumAuto-graded
    Shortest Path from Multiple Sources in a Grid

    Tests understanding of multi-source BFS to efficiently compute shortest distances from any of several starting points to many query locations.

    Trees & Graphsbfsgraph-traversalshortest-pathgrid
  • StringsMediumModel answer
    Extract and Safely Parse an XML Document Nested in CDATA

    Implement a function that pulls a nested XML document out of a CDATA section and reads an attribute from its root, while blocking XXE and entity-expansion attacks.

    Stringsxmlsecurityparsing
  • Data Structure DesignMediumAuto-graded
    Hash-Tree Diff: Detect File Changes Between Two Snapshots

    Tests ability to build a bottom-up Merkle hash tree from file path/content mappings and use subtree hash pruning to efficiently classify added, modified, and deleted files.

    Data Structure Designhashingtrees-graphsrecursion
  • Trees & GraphsMediumAuto-graded
    Spot the VIP in a Social Network

    Tests whether a candidate can exploit a single elimination insight to find a universal acquaintance in O(n) time instead of O(n²).

    Trees & Graphsgraphseliminationtwo-pass
  • Arrays & HashingEasyAuto-graded
    Random Assignment Statistics with Replacement

    Compute expected allocation count, reachability probability, and expected coverage when distributing items randomly with replacement.

    Arrays & Hashingprobabilityexpectationbinomialcomplement-rule
  • Math & Bit ManipulationMediumModel answer
    Build a [0,1) Sampler from Fair Coin Flips

    Design an algorithm that uses a fair-bit source to produce a number uniformly distributed on [0,1), and analyze its error and cost.

    Math & Bit Manipulationprobabilityrandomized-algorithmsbit-manipulationfloating-point
  • StringsMediumAuto-graded
    Case-Insensitive Substring Search Across a Music Catalog

    Tests ability to normalize user input and apply multi-field substring filtering across a collection of structured records.

    Stringsstringsfilteringcase-insensitive
  • Dynamic ProgrammingMediumAuto-graded
    Pack Expedition Gear Within Weight and Volume Limits

    Tests the 2-constraint (weight + volume) knapsack variant using DP with memoization or tabulation to maximize the total utility of selected gear items.

    Dynamic Programmingdynamic programmingknapsackmemoization
  • Trees & GraphsMediumAuto-graded
    Minimum Travel Cost with Layover Limit

    Tests weighted shortest-path reasoning under a hard constraint on the number of edges traversed, requiring a round-bounded relaxation strategy.

    Trees & Graphsgraphsbellman-fordshortest-path
  • Math & Bit ManipulationMediumModel answer
    Integer Sequence Rule Inference and Next-Term Prediction

    Design a systematic program that detects the governing rule of an integer sequence and predicts the next k terms, ranked by plausibility.

    Math & Bit Manipulationpattern-recognitionmodel-selectionfinite-differencesrecurrences
  • Data Structure DesignMediumModel answer
    Path Template Router with Variables and Wildcard Tails

    Build a trie-based URL router that registers templates with named captures and wildcard tails, resolves concrete paths with literal-first precedence and backtracking, and detects shape conflicts.

    Data Structure Designtrieroutingbacktrackingdesign
  • Trees & GraphsMediumAuto-graded
    Root-to-Leaf Sum Verification

    Tests depth-first traversal of a binary tree encoded as an indexed array to find paths matching a target sum.

    Trees & Graphsbinary-treedfsiterativepath-sum
  • Math & Bit ManipulationEasyAuto-graded
    Truth-Tellers and Liars: Deduce Two Island Identities

    Tests systematic logical deduction by resolving a two-person truth-teller/liar puzzle through exhaustive case analysis.

    Math & Bit Manipulationlogiccase-analysismath
  • Data Structure DesignMediumAuto-graded
    Simulate a Fixed-Capacity Circular Queue

    Tests ability to implement a circular buffer with O(1) enqueue/dequeue/peek and correct wraparound, full/empty handling, and ordered iteration.

    Data Structure Designcircular-bufferqueuearraysimulation
  • Arrays & HashingMediumAuto-graded
    Find Pair with Given Sum

    Tests the ability to use hash-based lookups for constant-time complement checking and handle input validation rigorously.

    Arrays & Hashinghash-tabletwo-pointersarray
  • Data Structure DesignMediumModel answer
    Company Hierarchy Query System with Dynamic Updates

    Build a data structure to efficiently query employee roles and reporting counts in a company hierarchy, then extend it to handle dynamic additions.

    Data Structure Designtreesgraphspreprocessingaggregation
  • Trees & GraphsMediumAuto-graded
    Grid Maze Shortest Path with A* Search

    Tests knowledge of informed graph search, admissible heuristics, priority-queue mechanics, and canonical path reconstruction on a 2-D grid.

    Trees & Graphsgraph-searcha-starbfsshortest-path
  • Greedy & IntervalsHardAuto-graded
    Maximize Profit from Weighted Deadline-Constrained Tasks

    Tests the classic weighted job scheduling with deadlines: greedily select a maximum-profit feasible subset of unit-length tasks, each with a deadline and profit, using a disjoint-set (union-find) structure for efficiency.

    Greedy & Intervalsgreedyschedulingunion-findintervals
  • StringsHardAuto-graded
    Sum Two Large Numbers Represented as Strings

    Tests whether a candidate can implement column-by-column addition with carry logic on digit strings, without converting the whole string to a native integer.

    Stringsstringsmath-bitssimulation
  • Trees & GraphsEasyModel answer
    Path Sum Validation in Binary Trees

    Determine whether any root-to-leaf path in a binary tree sums to a given target value.

    Trees & Graphsbinary-treedepth-first-searchtree-traversal
  • StringsEasyModel answer
    Log Ingestion Engine with Prefix-Operator Query Filtering

    Build a two-phase pipeline that parses raw server log lines into structured records and filters them using a mini query language of typed prefix tokens.

    Stringsparsingregexfilteringdesign
  • StringsEasyAuto-graded
    Process Sequential Variable Assignments

    Tests parsing and evaluating variable assignments in order, handling literals, references, and arithmetic expressions.

    Stringsparsingdictionaryexpression-evaluation