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 1081–1110 of 2787 results

  • 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
  • StringsMediumAuto-graded
    Find Minimum Substring with K Distinct Characters

    Determine the length of the shortest contiguous substring that contains a target count of unique lowercase letters using a sliding window technique.

    Stringssliding-windowstringstwo-pointershash-table
  • Trees & GraphsMediumModel answer
    Validate-As-You-Go Calculator with Positive Integer Results

    Evaluate a split-based arithmetic expression, returning false the moment any literal or intermediate value is non-positive or non-integer.

    Trees & Graphsrecursionexpression-evaluationpost-orderparsing
  • Data Structure DesignMediumModel answer
    Build an In-Memory Database with Querying and Indexing

    Design and write code for an in-memory document store that supports dynamic schemas, predicate filtering, projection, ordering, and index optimization.

    Data Structure Designin-memory-dbindexingdata-structuresdata-structure-design
  • Data Structure DesignMediumModel answer
    Concurrency Safety, Deadlocks, and Array vs Linked List Tradeoffs

    Four short fundamentals questions: what makes code safe under concurrent use, what a deadlock is, how to handle deadlocks, and how contiguous arrays compare with pointer-based linked lists.

    Data Structure Designconcurrencythread-safetydeadlockarrays
  • Data Structure DesignEasyAuto-graded
    Replay Keyed Updates and Report Per-Group Peak Values

    Simulate a log of keyed insert and query commands, keeping a running maximum for each key so single-key and all-key peak queries are answered without rescanning data.

    Data Structure Designhash-mapsimulationrunning-maximumdesign
  • Dynamic ProgrammingHardAuto-graded
    Maximum Non-Adjacent Node Value Sum in Binary Tree

    Find the maximum total node sum from a binary tree represented as a level-order list such that no two selected nodes share a parent-child edge.

    Dynamic Programmingtrees-graphsdynamic-programmingarrays
  • Trees & GraphsMediumAuto-graded
    Minimum Steps Across a Square Maze with Diagonal Moves

    Tests breadth-first search on a square binary grid with eight-directional moves, handling blocked endpoints, visited tracking, and counting cells along the shortest route.

    Trees & Graphsbfsgridshortest-pathgraph-traversal
  • Greedy & IntervalsHardModel answer
    Bird Physics Tick and Fee-Ratio Block Packing

    Two coding tasks: a one-tick bird movement function with inclusive bounds, and a greedy block builder that scores transactions together with their unconfirmed ancestors.

    Greedy & Intervalsgreedytopological-sortcycle-detectionsimulation
  • Greedy & IntervalsMediumAuto-graded
    Subscription Windows: Purchase Attribution and Anomaly Report

    Merge each user's subscription intervals, then attribute purchases to the merged windows, count September active days, and report out-of-window and overlap anomalies.

    Greedy & Intervalsintervalsmerge-intervalshash-mapdatetime
  • Heaps, Sorting & SearchHardAuto-graded
    Gift Card Waterfall, ZIP Surcharges and Refund Credits

    Simulate a stream of purchase and refund events that drain gift cards by expiry priority, surcharge the card remainder by ZIP range, and turn excess refunds into store credit.

    Heaps, Sorting & Searchsimulationheappriority-queuebinary-search
  • Dynamic ProgrammingMediumModel answer
    Left-to-Right Plus/Times Expression from a Subsequence

    Decide whether a subsequence of positive integers, joined by + and * and evaluated strictly left to right, can equal a target, and produce one valid expression.

    Dynamic Programmingdynamic-programmingbacktrackingpruningreverse-search
  • Data Structure DesignMediumModel answer
    Building a Slab Pool for Uniform Objects with Alignment Safety

    Design a pool allocator that carves equal-sized slots from slabs, hands them out via an intrusive free list in O(1), respects alignment, and packs 9-byte payloads sensibly.

    Data Structure Designmemory-allocatorslabfree-listalignment
  • Trees & GraphsMediumAuto-graded
    Sparse Vector Overlap Sum and Land Cluster Counter

    Combine a merge-style sparse vector dot product with an iterative flood fill that counts 4-connected land clusters, returning both results together.

    Trees & Graphstwo-pointerssparse-vectorgriddfs
  • Data Structure DesignMediumAuto-graded
    Execute Sequence of LRU Cache Instructions

    Simulate a Least Recently Used (LRU) cache supporting fast lookups, insertions, updates, and capacity evictions across a series of operations.

    Data Structure Designhash-tabledoubly-linked-listdesign
  • Dynamic ProgrammingMediumAuto-graded
    Count Grid Walkways Without Three Consecutive Steps

    Count valid grid paths composed of horizontal and vertical steps such that no direction is repeated three times in a row.

    Dynamic Programmingdynamic-programminggridcombinatoricsmemoization
  • Data Structure DesignMediumAuto-graded
    Serialize and Split Key-Value Store Payload

    Encodes a dictionary mapping string keys to string values into a binary protocol payload and splits it into fixed-size byte chunks.

    Data Structure Designencodingbinarystringsdesign-ds
  • Data Structure DesignEasyAuto-graded
    Replay a Command Script and Record Box State After Each Step

    Simulate an ordered list of color, delay and move commands on a box, tracking cumulative position and total waited time, and return a state snapshot after every command.

    Data Structure Designsimulationstate-machinearraysmethod-chaining
  • Math & Bit ManipulationEasyAuto-graded
    Rent and Occupancy Targets for a 100-Unit Apartment Building

    Apply a simple profit model with fixed costs, a rent-proportional cost and a target return to find a required rent and a required occupancy.

    Math & Bit Manipulationmathbreak-evenunit-economicsalgebra
  • Trees & GraphsMediumAuto-graded
    Minimum Web Page Hop Distance

    Find the shortest distance between two web pages in a directed link graph using breadth-first search.

    Trees & Graphsbfsgraphshortest-pathtrees-graphs
  • Dynamic ProgrammingMediumAuto-graded
    Distinct Sub-Multisets That Hit a Target Sum

    Enumerate every distinct selection of list elements, each used at most once, that sums to a target, with negatives, zeros and duplicates allowed. Tests backtracking over value counts.

    Dynamic Programmingbacktrackingsubset-sumduplicatesenumeration
  • Math & Bit ManipulationMediumAuto-graded
    Expected Number of Running Record Highs

    Compute the expected number of strict running maximum records for a uniformly random ordering of a collection of numbers.

    Math & Bit Manipulationmathprobabilityarrays
  • Data Structure DesignMediumAuto-graded
    Aggregate Executed Call Sequences across Threads

    Simulate an execution stream aggregator tracking stack call frequency across threads with custom tie-breaking rules.

    Data Structure Designdesign-dsarrayshash-table
  • Arrays & HashingMediumAuto-graded
    Can Your Unfinished Poker Hand Overtake a Showdown Hand?

    Decide whether a 3 or 4 card poker hand can be filled from the unseen deck into a five-card hand that strictly outranks a revealed five-card hand.

    Arrays & Hashingsimulationbrute-forcecombinationspoker
  • Heaps, Sorting & SearchMediumAuto-graded
    Bidirectional Bubble Sort with Early Exit and Shrinking Window

    Implement a two-direction adjacent-swap sort that returns a new sorted list, using window shrinking and early termination, while reasoning about its cost.

    Heaps, Sorting & Searchsortingtwo-pointersbubble-sortin-place
  • Data Structure DesignMediumAuto-graded
    Replay Path Insertions and Filename Lookups on a Component Trie

    Simulate an in-memory path trie driven by a list of add and search operations, with iterative traversal, path normalization, and exact rules for what counts as a file.

    Data Structure Designtrietree-traversaliterative-dfssimulation
  • Math & Bit ManipulationEasyAuto-graded
    Posterior for the Favorite After Your Entry Loses

    Apply Bayes' rule to find the chance a randomly chosen contestant was the strongest one, given that it did not win a three-way contest.

    Math & Bit Manipulationprobabilitybayes-ruleconditional-probabilitymath
  • Data Structure DesignMediumAuto-graded
    Replay a Bounded Recency Store from an Operation Log

    Simulate a fixed-size key-value store that discards the least recently touched entry when full, by replaying a log of operations and returning each result.

    Data Structure Designhash-maplinked-listsimulationcache
  • Data Structure DesignMediumModel answer
    Dynamic Anagram Collection Tracker with Group Size Optimization

    Design a class to insert, remove, and query the largest group of anagram words in real time, exploring performance trade-offs for read and write loads.

    Data Structure Designdesign-dsstringsarrays