KatInterview

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

Interview Practice Problems

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

6020
Problems
2229
Auto-graded
15
Topics
274
Added today

Showing 1351–1380 of 2229 results

  • 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
  • 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
  • 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
  • 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 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
  • 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 & 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
  • 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
  • SQL & DataMediumAuto-graded
    Count Distinct Users by Department and Time Window

    Tests set-based deduplication and join logic to find unique users who interacted with products in a specific department during a time range.

    SQL & Datadata-manipulationset-operationsfiltering
  • 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
  • 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
  • Arrays & HashingMediumAuto-graded
    Posterior Probability of Facility Given Red Samples

    Tests Bayesian reasoning: computing the posterior probability of a hypothesis using likelihoods and equal priors.

    Arrays & Hashingprobabilitybayes-theoremmathematical-reasoning
  • Arrays & HashingMediumAuto-graded
    All Orderings and Subsets of Distinct Integers

    Tests recursive backtracking by building every permutation and every k-length subset of a list of distinct integers in a single function.

    Arrays & Hashingbacktrackingrecursioncombinatorics
  • Math & Bit ManipulationHardAuto-graded
    Decompose an IP Range into the Fewest CIDR Blocks

    Tests greedy interval tiling and bit manipulation by converting an inclusive IPv4 address range into the minimum list of valid, aligned CIDR blocks.

    Math & Bit Manipulationbit-manipulationgreedynetworking
  • Arrays & HashingHardAuto-graded
    Cell Absorption Simulation: Dominant Cell After Feeding Rounds

    Simulate a row of cells that absorb weaker neighbors across repeated left-to-right rounds and identify the largest survivor at equilibrium.

    Arrays & Hashingsimulationarrayslist-mutation
  • StringsMediumAuto-graded
    First Window Matching a Letter-Frequency Snapshot

    Tests fixed-size sliding window technique with O(1) per-step character-count bookkeeping to locate the leftmost permutation of a pattern inside a longer string.

    Stringssliding-windowhash-maptwo-pointers
  • Heaps, Sorting & SearchMediumAuto-graded
    Collect All Closest Adjacent Value Pairs

    Tests sorting and greedy scanning to identify the smallest gap between elements and extract all pairs achieving it.

    Heaps, Sorting & Searchsortinggreedyarrays
  • Greedy & IntervalsMediumAuto-graded
    Calculate Worker Pay with Bonus Time Periods

    Tests interval merging, overlap calculation, and time-based pay aggregation with capped rate multipliers.

    Greedy & Intervalsintervalsarraysmath
  • SQL & DataMediumAuto-graded
    Join User Profiles and Purchase Records, Fill Gaps, Compute Line Spend

    Tests left-join logic, mode imputation for missing categorical fields, and null-safe row-level spend calculation using plain Python dicts.

    SQL & Datadata-manipulationjoinsnull-handling
  • Dynamic ProgrammingMediumAuto-graded
    Compact RLE Coder: Decode a String and Re-encode Under Pattern Limit

    Tests string parsing for RLE decoding and interval DP to find the shortest valid re-encoding when patterns are capped at length K.

    Dynamic Programmingstringsdynamic-programmingcompression
  • Trees & GraphsMediumAuto-graded
    Resolve Boolean Signal Chains with Negation and Cycle Detection

    Tests iterative functional-graph traversal: propagating True/False through chains of references and NOT, while correctly marking cycles, dangling references, and their dependents as unresolvable.

    Trees & Graphsgraph traversalcycle detectionhash map
  • Trees & GraphsMediumAuto-graded
    Extract String Leaf Paths from Nested JSON Structure

    Traverse nested dictionaries and lists to collect dot-and-bracket paths to all string values, returned in sorted order.

    Trees & Graphstree-traversaliterationstackpath-building
  • Stacks & QueuesHardAuto-graded
    Peak Values in Fixed-Length Subarrays

    Tests understanding of monotonic deques to efficiently track the largest element across consecutive fixed-size subarrays in linear time.

    Stacks & Queuesdequesliding-windowmonotonic-queue