KatInterview

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

Coding Interview Problems

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

6013
Problems
2228
Auto-graded
15
Topics
273
Added today

Showing 1981–2010 of 2781 results

  • Linked ListsMediumAuto-graded
    Reorder Linked List by Zigzag Level Buckets

    Tests pointer-manipulation intuition by reordering a singly-linked list (given as an array) into a zigzag pattern based on partitioning nodes into fixed-size buckets.

    Linked Listslinked listsarray manipulationreordering
  • Dynamic ProgrammingMediumModel answer
    Maximum Valid-Partition Block Count for Every Prefix

    For each prefix of a string, find the maximum number of contiguous blocks it can be split into where every character in a block shares the same frequency.

    Dynamic Programmingdynamic programmingstringsfrequency countingprefix processing
  • Math & Bit ManipulationMediumAuto-graded
    Optimal Ball Distribution for Maximum Joint Red Probability

    Tests ability to formulate and optimize a probability function over discrete allocations with boundary analysis.

    Math & Bit Manipulationprobabilityoptimizationmath
  • Heaps, Sorting & SearchEasyAuto-graded
    Minimum Consecutive Gap Frequency

    Sort an array, find the smallest difference between adjacent elements, and count how many consecutive pairs share that difference.

    Heaps, Sorting & Searcharrayssortingcounting
  • Trees & GraphsHardAuto-graded
    Minimum Time to Complete All Build Tasks with Dependencies

    Tests ability to apply topological ordering (Kahn's algorithm) to schedule parallel tasks with durations and prerequisite chains, computing the earliest completion time.

    Trees & Graphsgraphstopological sortdynamic programmingBFS
  • Arrays & HashingMediumAuto-graded
    Three Probability Puzzles

    Tests understanding of optimal stopping, geometric probability, and Poisson processes through three independent probability calculations.

    Arrays & Hashingprobabilityoptimal-stoppingpoisson-processgeometric-probability
  • Greedy & IntervalsHardModel answer
    Equalize Array Range with Bounded Transfers

    Find the minimum operations to narrow an array's range below a threshold by transferring bounded amounts between pairs of elements.

    Greedy & Intervalsgreedybinary-searchmathoptimization
  • Dynamic ProgrammingMediumAuto-graded
    Smallest Venue Set That Fits a Group

    Tests capacity-constrained subset selection with multi-level tie-breaking: fewest venues, then minimum total capacity, then lexicographically smallest ID list.

    Dynamic Programmingdynamic-programmingsubset-sumcombinatorics
  • Data Structure DesignMediumModel answer
    Build an Edit History System with Batching

    Implement a command history mechanism supporting single edits, grouped operations, and bidirectional traversal through past states.

    Data Structure Designundo-redocommand-patternstate-management
  • Data Structure DesignMediumModel answer
    Build a Scoped Owner and a Resizable Container from Scratch

    Implement a move-only smart pointer and a generic dynamic array in C++, exercising RAII, the Rule of Five, placement new, and exception-safe resizing.

    Data Structure Designc++memory-managementraiimove-semantics
  • StringsHardAuto-graded
    Minimum Prefix Extension to Form a Palindrome

    Tests whether you can use the KMP failure function to find the longest palindromic prefix of a string and prepend the minimum number of characters to make it a palindrome.

    Stringsstringskmppalindrome
  • Data Structure DesignHardModel answer
    Building a Live Text Editor: Buffer, History, and Suggestions

    Design and implement a text editor with insert/delete operations, undo/redo history, prefix-based autocomplete with frequency ranking, and multi-user concurrent editing.

    Data Structure Designdata-structuresundo-redotrieoperational-transformation
  • Data Structure DesignMediumAuto-graded
    Maintain Contiguous Delivery Sequence and Detect Gaps

    Tests managing out-of-order arrivals with sets to track the longest complete prefix and identify missing elements in a sparse range.

    Data Structure Designsetstrackingstate-management
  • Trees & GraphsMediumModel answer
    Assemble a Binary Tree from Parent-Child Edge Records

    Given a list of directed labeled edges, reconstruct the binary tree they describe and return its root node.

    Trees & Graphsbinary-treehash-maptree-construction
  • Data Structure DesignMediumAuto-graded
    Time-Travel Array with Historical Query Support

    Design a data structure that tracks an array's evolution through snapshots and answers queries about past states efficiently.

    Data Structure Designbinary-searchversioningdata-structures
  • StringsMediumAuto-graded
    Extract Stock Symbols from a Text Snippet

    Tests whole-word, case-insensitive multi-token matching with trie-based scanning and deduplication ordered by a reference list.

    Stringsstringshashingtrie
  • Arrays & HashingHardAuto-graded
    Peak Subarray Sum in a Run-Length-Encoded Sequence

    Tests whether a candidate can find the maximum sum of a fixed-length window over a run-length-encoded array too large to expand in memory.

    Arrays & Hashingsliding-windowprefix-sumsrun-length-encodingbinary-search
  • StringsMediumAuto-graded
    Widest Alphabetic Boundary Gap Across Tokens

    Tests string scanning, ASCII letter detection, and single-pass maximum tracking with tie handling across whitespace-delimited tokens.

    Stringsstringsscanningcase-normalizationties
  • Arrays & HashingEasyAuto-graded
    Verify Which Orders Have Received Payments

    Given two unsorted lists of records linked by a shared booking_id, return a boolean per order indicating whether at least one matching payment exists.

    Arrays & Hashinghash-setlookupaggregation
  • Trees & GraphsMediumAuto-graded
    Grid Land Regions: Total Count and Unique Footprints

    Tests grid flood-fill for connected-component counting and translation-invariant shape canonicalization to identify structurally distinct land regions.

    Trees & Graphsgraph traversalflood fillconnected componentshashing
  • StringsMediumModel answer
    Java String Interning, Identity, and Concatenation Costs

    Trace identity vs equality across literals, `new String`, `intern`, and constant folding, then compare loop `+`, `StringBuilder`, and `StringBuffer`.

    Stringsjavastring-poolimmutabilitystringbuilder
  • Trees & GraphsMediumAuto-graded
    Minimum-Cost Flight Path with Departure Window

    Tests constrained graph search: find the cheapest multi-leg flight route where only the first leg must depart within a given date range, connections must respect time ordering, and cycles are forbidden.

    Trees & Graphsdijkstragraphsshortest-path
  • Trees & GraphsMediumAuto-graded
    Mutual Connections: Find Shared Friends from Follow Data

    Tests graph reciprocity reasoning and set intersection: given directed follow edges, identify all users who are mutual friends with both members of every user pair.

    Trees & Graphsgraphsset-intersectionsocial-network
  • Trees & GraphsEasyAuto-graded
    Shortcut by Adding Free Unit Edges

    Reason about degrees of freedom: since you may add arbitrary weight-1 edges, the optimal distance collapses to a constant.

    Trees & Graphsgraphsshortest-pathreasoningedge-cases
  • Trees & GraphsMediumAuto-graded
    Minimum Water Cells to Connect Two Land Masses

    Tests ability to combine flood-fill island identification with multi-source BFS to find the shortest water path bridging two disconnected land regions in a grid.

    Trees & Graphsbfsgridflood-fill
  • Heaps, Sorting & SearchHardAuto-graded
    Nearest Profiles by Masked Mean Squared Error

    Tests pairwise distance computation with a missing-data-aware MSE metric, tie-breaking, and top-K ranking across user profiles.

    Heaps, Sorting & Searchsortingsimilaritymissing-data
  • Heaps, Sorting & SearchMediumAuto-graded
    Minimum Cost to Combine All Elements

    Tests greedy algorithm design and min-heap operations to repeatedly merge pairs optimally.

    Heaps, Sorting & Searchheapgreedypriority-queue
  • Trees & GraphsHardAuto-graded
    Filter Hierarchical Records by Ancestor Validity

    Tests memoized path traversal in a parent-pointer hierarchy with cycle detection and ancestral filtering rules.

    Trees & Graphsgraphsmemoizationcycle-detection
  • Data Structure DesignMediumAuto-graded
    Word Dictionary with Insert and Query Operations

    Tests implementing a character-level trie to handle insert, exact-match lookup, and prefix-existence queries while distinguishing complete words from prefixes.

    Data Structure Designtriedata-structuresstring-matching
  • Arrays & HashingHardAuto-graded
    Minimum Window Containing All K Most-Frequent Characters

    Tests ability to combine hash-counting (frequency maps) with a sliding window to find the shortest contiguous subarray satisfying a dynamic frequency-based constraint.

    Arrays & Hashingarrayshash mapsliding windowfrequency counting