KatInterview

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

Coding Interview Problems

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

6033
Problems
2234
Auto-graded
15
Topics
274
Added today

Showing 1711–1740 of 2787 results

  • Trees & GraphsMediumAuto-graded
    Assemble Tree from Edge Specifications

    Tests building a tree structure from unordered edge list by tracking node relationships and identifying the root.

    Trees & Graphstreeshash-tablegraph-construction
  • Data Structure DesignMediumAuto-graded
    Versioned Key-Value Store with Global Version Tracking

    Implement a key-value store where each write increments a global version counter and reads retrieve values by version using binary search.

    Data Structure Designbinary-searchdata-structuresversioning
  • Trees & GraphsMediumAuto-graded
    Equal Binary Digits and Ascending Tree Chain

    Tests prefix-sum balancing for binary arrays and depth-first search for strictly increasing root-to-leaf paths in binary trees.

    Trees & Graphstreesarraysprefix-sumdfs
  • Math & Bit ManipulationMediumAuto-graded
    Two-Year Show Profit: Renewal vs. New Launch

    Compute two-year profits for two show options, blend the new show's outcomes by success probability, and find the break-even probability.

    Math & Bit Manipulationarithmeticexpected-valuebreak-evenbusiness-math
  • Data Structure DesignMediumModel answer
    Dynamic Hierarchy Manager with Timestamp Ordering

    Build a system that processes timestamped parent-child updates arriving in any order, maintains a valid tree structure, and prevents cycles.

    Data Structure Designtreesgraphsstate-managementcycle-detection
  • StringsHardAuto-graded
    Encode Consecutive Character Runs as Digit Sequences

    Tests run-length encoding with multi-digit counts split into individual characters, requiring careful pointer management and constant-space thinking.

    Stringstwo-pointersrun-length-encodingin-place
  • Arrays & HashingMediumAuto-graded
    Grid Walker with Blocked Cells

    Tests simulation with hash-based obstacle lookup, movement logic, and tracking a running maximum over coordinate positions.

    Arrays & Hashingsimulationhash-setgrid
  • Heaps, Sorting & SearchMediumAuto-graded
    Merge Sorted Event Streams with Running Sum

    Tests k-way merging of pre-sorted sequences using a min-heap, deterministic tie-breaking by source index, and accumulating a running total across all events.

    Heaps, Sorting & Searchheapmergek-way-mergerunning-sum
  • Dynamic ProgrammingMediumAuto-graded
    Score Bust Probability: Stop When You Hit the Target

    Tests whether a candidate can build an O(n) sliding-window DP to compute the probability that a random accumulation process stops within a given score ceiling.

    Dynamic Programmingdynamic-programmingsliding-windowprobability
  • Trees & GraphsMediumModel answer
    Content-Based Duplicate File Detector

    Recursively scan a directory tree, group files by size then content hash, and return every set of two or more paths that hold identical bytes.

    Trees & Graphshashingfile-systemtraversaldeduplication
  • StringsMediumAuto-graded
    Multiply Large Numbers as Strings

    Tests implementation of grade-school multiplication on arbitrarily large integers represented as strings without using built-in big integer operations.

    Stringsmathsimulationarray-manipulation
  • Data Structure DesignMediumModel answer
    Design a Five-Card Hand Evaluator with Partial Hand Completion

    Model poker-style five-card hands with an abstract type hierarchy, compare two hands by strength and tie-break, then find the strongest and weakest completions of a partial hand.

    Data Structure Designobject-oriented designclassificationcombinatoricscomplexity analysis
  • Arrays & HashingMediumAuto-graded
    Single Buy-Sell Transaction for Maximum Gain

    Tests optimal single-pass tracking of minimum buy price to maximize profit from one stock transaction.

    Arrays & Hashingarraysgreedyoptimizationsingle-pass
  • Arrays & HashingMediumAuto-graded
    Build Sorted Email Event Timeline for Subscriptions

    Tests date arithmetic, multi-level sort stability, and designing a rule system that cleanly handles event ordering and extensibility.

    Arrays & Hashingsortingdatessimulation
  • Data Structure DesignMediumModel answer
    Concurrent Task Execution with Type-Level Exclusion

    Build a synchronization mechanism allowing tasks of the same type to run together while blocking tasks of different types from overlapping.

    Data Structure Designconcurrencythreadingsynchronization
  • Data Structure DesignMediumAuto-graded
    Simulate a Linked List with Iterator and Transform

    Tests ability to implement a doubly-linked list supporting sequential iteration and non-mutating element-wise transformation via a command-driven simulation.

    Data Structure Designlinked-listiterator-patternhigher-order-functions
  • Data Structure DesignMediumModel answer
    Defensive Coding: Validate and Harden a Snake Game

    Design an input-validation strategy, error-handling policy, and test suite to protect a Snake game implementation from every class of bad input.

    Data Structure Designvalidationerror-handlingtestingsnake-game
  • Heaps, Sorting & SearchMediumAuto-graded
    Merge K Sorted Lists to Find Smallest Elements

    Tests efficient multi-way merge using a min-heap to extract the k smallest values from multiple sorted arrays without flattening the entire input.

    Heaps, Sorting & Searchheapmergesortingoptimization
  • Data Structure DesignMediumAuto-graded
    Fixed-Capacity Eviction Cache with Recency Tracking

    Tests whether you can design a cache that evicts the least recently accessed entry in O(1) time by combining a hash map with an ordered structure.

    Data Structure Designhash-maplinked-listdesigncache
  • Trees & GraphsMediumModel answer
    Find the Longest Path in an Undirected Tree

    Given a tree as an adjacency list, return the sequence of nodes forming its diameter — the longest simple path between any two nodes.

    Trees & GraphsBFSDFStree diameterpath reconstruction
  • Heaps, Sorting & SearchHardModel answer
    Rolling Window Median Bounds + Binary Array Tiling

    Find the max and min sliding-window medians in O(n log k), then partition a binary array into even uniform segments with minimum flips.

    Heaps, Sorting & Searchsliding windowheapdynamic programmingbinary array
  • Trees & GraphsHardAuto-graded
    Detect a Profitable Currency Trade Loop

    Tests whether you can model exchange rates as a weighted directed graph and apply Bellman-Ford to detect a cycle whose rate product exceeds 1.

    Trees & Graphsgraphsbellman-fordlogarithms
  • Arrays & HashingMediumModel answer
    Layered Invoice Processor with Discounts, Tax, and FX

    Build a multi-part order cost engine that handles input validation, per-item discounts, order-level tax, multi-currency conversion, and banker's rounding.

    Arrays & Hashingdata-processingdecimal-arithmeticinput-validationsorting
  • Trees & GraphsMediumAuto-graded
    Reachable Stocked Nodes Within a Hop Limit

    Tests BFS on an undirected graph to filter nodes by shortest-path distance and a secondary inventory condition, including edge-case handling for missing keys and duplicates.

    Trees & Graphsbfsgraphsshortest-path
  • Data Structure DesignHardModel answer
    Build a Subscription Pattern Recognition Engine

    Create a system that discovers recurring billing patterns in transaction data, handling merchant name variations, timing drift, and price changes.

    Data Structure Designpattern-recognitiondata-processingheuristics
  • Data Structure DesignMediumModel answer
    Build an In-Memory Promo Code Service

    Design and implement a class that creates, validates, and redeems promotional discount codes with expiry, global and per-user limits, and idempotent retries.

    Data Structure Designhash-mapexpirationidempotencyconcurrency
  • Math & Bit ManipulationMediumAuto-graded
    Fewest Steps to Reach One

    Tests greedy reasoning over binary structure to find the minimum number of halving and increment/decrement steps needed to reduce a positive integer to 1.

    Math & Bit Manipulationgreedybit-manipulationmath
  • Data Structure DesignMediumModel answer
    Design a Multiset Trie with Fast Prefix Counting

    Build a trie that tracks word multiplicities, supports insertion, deletion, exact and prefix lookup, and handles Unicode safely.

    Data Structure Designtriedata-structuresconcurrencyunicode
  • Arrays & HashingMediumAuto-graded
    Count Members With Continuous Subscription at Final Timestamp

    Tests per-entity state simulation where a subscription can only be renewed while still active, and any lapsed subscription is permanently void.

    Arrays & Hashingsimulationhash-mapstate-machine
  • Data Structure DesignMediumAuto-graded
    Board Game: Detect k-in-a-Row on a Rectangular Grid

    Tests incremental win detection on an m×n board by tracking consecutive run lengths at endpoints to check for k-in-a-row in O(1) per move.

    Data Structure Designdesignarrayssimulation