KatInterview

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

Coding Interview Problems

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

6029
Problems
2232
Auto-graded
15
Topics
273
Added today

Showing 1051–1080 of 2785 results

  • Data Structure DesignMediumModel answer
    Design a Multi-Tenant Security Event Enrichment Engine

    Design and implement an in-memory pipeline to enrich telemetry events and evaluate dynamic suppression rules with multi-tenant scoping and fault tolerance.

    Data Structure Designdesignobject-orientedmulti-tenancypipelines
  • Arrays & HashingMediumModel answer
    Uniform Random Array Partitioning into K Segments

    Divide an array into K non-empty contiguous slices such that every valid partition is equally likely to be selected.

    Arrays & Hashingarraysmath-bitsheaps-sorting
  • Stacks & QueuesEasyAuto-graded
    Stack Simulator with Constant-Time Minimum Queries

    Simulate a sequence of stack commands and answer minimum queries in constant time by tracking the running minimum alongside each element.

    Stacks & Queuesstackdesignsimulationauxiliary-stack
  • Data Structure DesignHardAuto-graded
    Running Bit-Entropy of a Token Feed with Stable Updates

    Maintain Shannon entropy of a growing token stream with constant-time updates and queries, avoiding catastrophic cancellation when one token dominates.

    Data Structure Designstreamingnumerical-stabilityhash-mapentropy
  • Data Structure DesignMediumModel answer
    Design a Support Agent Dispatcher with Interruption Handling

    Design an in-memory dispatch engine that pairs queued support tickets with available agents, extended to handle mid-task agent breaks and fair ticket re-queuing.

    Data Structure Designdesign-dsstacks-queuesheaps-sorting
  • Arrays & HashingEasyAuto-graded
    Most Frequent Log Error Codes in Time Interval

    Filter log entries within a half-open time interval, compute occurrence frequencies, and retrieve the top k error codes sorted by frequency and string order.

    Arrays & HashingArrays & HashingSortingHash Table
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Independent Set on Line and Binary Tree

    Find the maximum weight independent set for both a linear sequence and a binary tree network under non-adjacency constraints.

    Dynamic Programmingdynamic-programmingtrees-graphsarrays
  • Data Structure DesignMediumModel answer
    Fix a Rotating Server Picker, Then Build a Hash Ring

    Find and fix the bugs in a round-robin server selector that handles pool changes and threads, then build a consistent-hash ring with virtual nodes that keeps key movement minimal.

    Data Structure Designload-balancingconsistent-hashingdebuggingconcurrency
  • Arrays & HashingMediumAuto-graded
    Validated Config-Driven LiDAR Scan Processor

    Validate a declarative list of crop and rigid-transform steps up front, then apply them in order to a point list while tracking metadata, without mutating the inputs.

    Arrays & Hashingsimulationvalidationmatrix-transformfiltering
  • Arrays & HashingMediumModel answer
    Paginated API Fetching and Data Merging

    Fetch paginated JSON payloads from two separate endpoints, defensively clean and transform records, and merge them on a common key preserving the original sequence.

    Arrays & Hashingpaginationhttp-requestshash-tabledata-cleaning
  • Trees & GraphsMediumAuto-graded
    Merge Per-User Action Sequences into a Counted Prefix Tree

    Group event records by user, order each user's events by time, merge the sequences into a prefix tree with distinct-user counts, and print it in a fixed preorder format.

    Trees & Graphstriehash-mapstable-sortdfs
  • Data Structure DesignMediumModel answer
    Build a Weekly Schedule Grid

    Construct an interactive 7-day schedule grid with hour slots, allowing users to add titled events via a clean, state-driven dialog without duplicate data sources.

    Data Structure Designfrontendreactstate-managementui-components
  • Arrays & HashingEasyAuto-graded
    Calculate Sample Size per Variant for A/B Testing

    Compute the minimum sample size required per group for a two-sample z-test given standard deviation, MDE, power, and significance level.

    Arrays & Hashingstatisticsa-b-testinghypothesis-testingmath
  • Data Structure DesignMediumAuto-graded
    Simulate a Ring Buffer Queue from a Command Log

    Replay a list of queue commands against a bounded ring buffer, returning each command's result while handling wrap-around, full and empty states correctly.

    Data Structure Designcircular-queuering-buffersimulationmodular-arithmetic
  • Heaps, Sorting & SearchMediumAuto-graded
    Generate Unique Lexicographical Permutations

    Enumerate all unique permutations of an integer list containing duplicates in lexicographically sorted order.

    Heaps, Sorting & Searcharrayssortingbacktrackingrecursion
  • Arrays & HashingMediumAuto-graded
    Fit a Line by Full-Batch Gradient Descent on Squared Error

    Implement full-batch gradient descent for a one-feature linear model, using gradients from the old parameters at every step to update the slope and intercept together.

    Arrays & Hashinggradient-descentlinear-regressionnumericalsimulation
  • Trees & GraphsMediumModel answer
    Analyze Referral Chains and Detect Graph Cycles

    Process referral relationships with at most one parent per user. Detect cycles, extract acyclic prefixes, and compute root ancestors and depths for all users in O(n) total time.

    Trees & Graphstrees-graphsdfscycle-detectiongraph-traversal
  • Arrays & HashingEasyAuto-graded
    Static Array Range Sum Queries

    Process a sequence of range sum queries on an immutable array efficiently using prefix sums.

    Arrays & Hashingarraysprefix-sumdata-structures
  • Trees & GraphsMediumAuto-graded
    Perform Connected Component Recolor on Grid

    Perform a flood-fill recoloring on a 2D integer grid while avoiding call stack overflow and preserving the original input.

    Trees & Graphsbfs-dfsmatrixflood-fillgraph-traversal
  • Arrays & HashingMediumAuto-graded
    Survey Click-Through and Score Averages from Impression Logs

    Group survey impression records to compute a click rate, a plain score average, and an average of each user's earliest score per survey, with careful handling of missing values.

    Arrays & Hashinghash-mapgroupingsortingnull-handling
  • StringsMediumModel answer
    Validate Palindrome Rearrangements and Sum High-Precision Decimals

    Check if a string's characters can form a palindrome, and implement precise addition of non-negative decimal strings without using native floating-point types.

    Stringsstringsmath-bitshash-table
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Bookings in a Weekly Schedule

    Parse weekday and 24-hour time strings, then merge touching or overlapping same-day bookings and output them in a canonical, sorted string format.

    Greedy & Intervalsintervalssortingstring-parsingmerge-intervals
  • Dynamic ProgrammingMediumAuto-graded
    Cheapest Right-and-Down Route Across a Cost Map

    Compute the minimum total cost of a route through a rectangular cost grid using only right and down moves, which tests 2D dynamic programming with a space optimization.

    Dynamic Programmingdynamic-programminggridmatrixoptimization
  • Heaps, Sorting & SearchMediumModel answer
    Find Frequent Elements in Large-Scale Data Streams

    Design scalable algorithms to extract the top K most frequent elements from a data stream under both memory-bounded exact and memory-constrained approximate regimes.

    Heaps, Sorting & Searchheaps-sortingdesign-dsarrays
  • Trees & GraphsMediumAuto-graded
    Evaluate Variable Expressions with Dependencies

    Evaluate symbolic variable definitions with standard arithmetic precedence, resolving variable dependencies while detecting cycles and missing definitions.

    Trees & Graphstrees-graphsstacks-queuestopological-sortrecursion
  • StringsMediumModel answer
    Debugging and Hardening a Lightweight Template Engine

    Trace three root causes in a minimal template rendering engine—regex greediness, loop parsing, and path traversal—and present targeted fixes with regression tests.

    Stringsdebuggingparsingregexsecurity
  • Trees & GraphsEasyAuto-graded
    Largest Cluster of Two-Digit Numbers Linked by Common Digits

    Find the largest connected cluster in a list of two-digit numbers where links come from shared digits, testing graph connectivity modeling with union-find or digit-hub nodes.

    Trees & Graphsunion-findconnected-componentsbitmaskgraph
  • Trees & GraphsMediumAuto-graded
    Shortest Grid Path to Nearest Fulfillment Hub

    Find the minimum travel distance from every destination point to its closest source hub on a 2D grid using multi-source Breadth-First Search.

    Trees & GraphsBFSMulti-Source BFSGrid TraversalShortest Path
  • Math & Bit ManipulationMediumAuto-graded
    Determine if Two Coin Stacks Can Be Equalized by Doubling

    Determine if two initial quantities can reach equality through deterministic transfers that double the recipient stack.

    Math & Bit Manipulationmath-bitsnumber-theorybit-manipulationsimulation
  • Dynamic ProgrammingMediumAuto-graded
    Minimum Containers for Target Volume

    Find the minimum combination of reusable containers to reach an exact target total volume, or return None if impossible.

    Dynamic Programmingdynamic-programmingunbounded-knapsackbacktracking