KatInterview

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

Coding Interview Problems

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

5997
Problems
2221
Auto-graded
15
Topics
270
Added today

Showing 2281–2310 of 2773 results

  • Data Structure DesignEasyModel answer
    Build an Event Dispatcher with Subscribe and Notify Operations

    Design and implement a subscription-based event system where functions can subscribe to event identifiers and be invoked when those events are triggered.

    Data Structure Designevent-systemcallbackserror-handlingreentrancy
  • Arrays & HashingEasyAuto-graded
    Neural Network Implementation of Centroid-Based Classification

    Derives the weight matrix and bias vector of a single-layer network that performs soft assignment to cluster centers using squared distance.

    Arrays & Hashingneural-networksclusteringlinear-algebra
  • StringsMediumAuto-graded
    Minimum Edit Distance to Make String a Palindrome

    Tests whether a candidate can compute the minimum number of single-character insertions needed to transform an arbitrary string into a palindrome using interval DP.

    Stringsstringsdynamic programmingpalindromesedit operations
  • Trees & GraphsMediumAuto-graded
    Resolve Variable Dependencies with Arithmetic

    Tests dependency graph traversal, cycle detection, and recursive evaluation of variables defined by arithmetic expressions.

    Trees & Graphsrecursiongraph-traversalcycle-detectionparsing
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Ranges

    Tests ability to sort intervals and merge adjacent or overlapping ranges into a minimal disjoint set.

    Greedy & Intervalsarrayssortinggreedy
  • Arrays & HashingMediumAuto-graded
    Filter Devices by Status, Threshold, and Registration Month

    Tests nested JSON navigation, timestamp parsing in UTC, date-range filtering, and numeric comparison with multiple simultaneous predicates.

    Arrays & Hashingjsondatetimefilteringdata-processing
  • Heaps, Sorting & SearchMediumAuto-graded
    Merge Sorted Streams with Memory Constraint

    Tests heap-based merging of multiple sorted sequences under strict O(k) space while maintaining stable duplicate handling.

    Heaps, Sorting & Searchheapsortingmergespace-complexity
  • StringsHardAuto-graded
    Mini Policy Engine: Boolean Rule Evaluation for Post Routing

    Tests whether a candidate can build a recursive-descent parser for a small boolean expression language and wire it into a first-match rule dispatcher.

    Stringsparsingrecursionstring processing
  • Data Structure DesignMediumModel answer
    Build a Thread-Safe Batched Log Writer

    Create a logger that safely accepts messages from multiple threads, buffers them in memory, and writes batches to disk based on size or time triggers.

    Data Structure Designconcurrencythreadingproducer-consumerbuffering
  • Heaps, Sorting & SearchMediumAuto-graded
    Greedy Task Merging and Segment Removal Cost

    Tests greedy heap-based merge cost minimization and prefix-sum sliding-window removal to minimize adjacent absolute differences.

    Heaps, Sorting & Searchgreedyheapprefix-sumssliding-window
  • Trees & GraphsMediumModel answer
    Grid Containment: Minimum Removals to Stop Spread

    Find the fewest cells to remove from a grid to prevent infection from spreading to healthy neighbors.

    Trees & Graphsbipartite-matchinggraph-theorygridvertex-cover
  • Trees & GraphsMediumModel answer
    Compute Direct and Total Network Reach for Each User

    Given a list of sponsor–member pairs, return the direct and full downstream unique reach count for every user, handling duplicates, converging paths, and cycles.

    Trees & GraphsgraphsBFSreachabilitycycles
  • StringsMediumAuto-graded
    Tiered Identity Validation for Business Onboarding

    Tests your ability to implement a sequential rule-engine with string normalization, token-set comparison, and strict short-circuit logic across three validation tiers.

    Stringsstringshashingsimulation
  • Data Structure DesignHardModel answer
    Amusement Park Tap-to-Ride: Credits, Surcharges, and Refunds

    Simulate a wristband payment system that drains expiring credits before a linked card, applies zone-based surcharges, and splits refunds back across both funding sources.

    Data Structure Designsimulationpriority-queuestate-management
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Population Variance Using Welford's Method

    Tests ability to implement numerically stable variance computation with single-pass streaming aggregation and handling of floating-point precision issues.

    Math & Bit Manipulationmathstatisticsnumerical-stabilitystreaming
  • Math & Bit ManipulationHardAuto-graded
    Splitting Tokens: Will a Bucket Ever Run Dry?

    Tests whether a candidate can identify a modular-arithmetic invariant to avoid simulating an exponentially long process.

    Math & Bit Manipulationmathbit-manipulationnumber-theory
  • Heaps, Sorting & SearchMediumAuto-graded
    Slice a Sorted Event Stream by Timestamp Window

    Tests binary search boundary reasoning on a sorted sequence with duplicate timestamps and inclusive range semantics.

    Heaps, Sorting & Searchbinary-searcharrayssorting
  • Greedy & IntervalsMediumAuto-graded
    Peak Concurrent Tasks: Minimum Workers Needed

    Tests interval overlap detection using sweep-line or heap techniques to find the maximum number of simultaneously active tasks.

    Greedy & Intervalsintervalssortingheapsweep-line
  • Arrays & HashingMediumAuto-graded
    Shortest Subarray With All K Distinct Characters Present

    Tests ability to use a sliding window with a hash-count map to find the minimum-length contiguous subarray that contains every distinct character appearing in a string at least a given number of times.

    Arrays & Hashingarrayshash mapsliding window
  • Stacks & QueuesMediumAuto-graded
    Compute an Arithmetic Expression Honoring Operator Precedence

    Tests ability to parse and compute integer arithmetic respecting operator precedence without using eval or a full expression parser.

    Stacks & Queuesparsingoperator-precedencestack
  • StringsMediumAuto-graded
    Chunked Stream Parser and Debt Settlement

    Tests buffered string parsing over an incremental data source combined with greedy net-balance clearing across a set of financial transfers.

    Stringsstringsgreedy-intervalsdesign-ds
  • Stacks & QueuesMediumAuto-graded
    Evaluate Nested Arithmetic Brackets with Sign Propagation

    Tests expression evaluation using a monotonic/simulation stack to handle deeply nested signed bracket expressions with +/- operators and integer literals.

    Stacks & Queuesstacksexpression evaluationparsingsimulation
  • Arrays & HashingHardAuto-graded
    Computing Equilibrium Bids in Single-Item Auctions

    Tests understanding of dominant strategy equilibria in second-price auctions and Bayesian Nash equilibria in first-price auctions with uniform value distributions.

    Arrays & Hashinggame-theoryauction-theoryexpected-valuebayesian-equilibrium
  • Data Structure DesignMediumAuto-graded
    Versioned Social Graph: Follow, Snapshot, and Recommend

    Tests data-structure design for a directed follow graph with copy-on-snapshot history and friend-of-friend recommendations ranked by mutual count.

    Data Structure Designhash-mapsimulationdesign
  • Arrays & HashingHardAuto-graded
    Collect All Valid Triples in a Four-Attribute Card Game

    Tests recognition of a combinatorial validity rule across four ternary attributes and the insight that any two cards uniquely determine the third, reducing O(n³) brute force to O(n²).

    Arrays & Hashinghashingcombinatoricsmath
  • Arrays & HashingMediumAuto-graded
    Compute Speeding Penalties from Trajectory Data

    Measures violations of a velocity threshold by calculating duration and magnitude of excess speed from sampled position sequences.

    Arrays & Hashingarrayssimulationnumerical-methods
  • Data Structure DesignMediumModel answer
    Build a Fox-and-Geese Turn-Based Grid Game Engine

    Model the board state, movement rules, and win conditions for an asymmetric two-player grid game where geese try to reach the far side while foxes hunt them.

    Data Structure Designobject-oriented designgame enginesimulationstate machine
  • Heaps, Sorting & SearchMediumAuto-graded
    K Nearest Value Pairs in a Sorted Sequence

    Tests whether a candidate can efficiently extract the k pairs with smallest gap from a sorted array using a heap-based k-way merge instead of brute force enumeration.

    Heaps, Sorting & Searchheapsortingtwo-pointersarrays
  • Data Structure DesignHardModel answer
    Tiered Cache Manager with Expiry and Weighted Retrieval

    Implement a multi-level cache that evicts expired entries, checks tier utilization, and retrieves the highest-weight item from any eligible tier.

    Data Structure Designheaplazy-deletionmulti-levelexpiration
  • Data Structure DesignMediumAuto-graded
    Circular Buffer with Fixed Capacity

    Tests implementation of a bounded FIFO queue using circular array indexing with constant-time operations.

    Data Structure Designqueuecircular-bufferarraydata-structure-design