KatInterview

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

Coding Interview Problems

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

6029
Problems
2232
Auto-graded
15
Topics
273
Added today

Showing 1741–1770 of 2785 results

  • Data Structure DesignMediumModel answer
    Build a Nested-Transaction Key–Value Store from Scratch

    Design and implement an in-memory key–value store that supports arbitrarily nested BEGIN/COMMIT/ROLLBACK transactions with correct shadowing and O(1) reads.

    Data Structure Designhash-mapstacktransactionsundo-log
  • 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
  • Arrays & HashingMediumModel answer
    Writing Test Cases for Array and String Problems

    Design a systematic testing strategy for array and string coding problems, covering edge cases, validation, and stress testing.

    Arrays & Hashingtestingedge-casesdebugging
  • 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
  • Data Structure DesignMediumModel answer
    Build a Stack That Also Tracks and Removes the Maximum

    Design a stack supporting push, pop, top, peekMax, and popMax, with two implementations trading off simplicity against O(log n) worst-case popMax.

    Data Structure Designstackheaplinked-listamortized-complexity
  • 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
  • Heaps, Sorting & SearchMediumAuto-graded
    Three-Way Color Partition

    Tests the ability to partition an array into three distinct categories using a single-pass, constant-space algorithm.

    Heaps, Sorting & Searcharraystwo-pointerssortingpartitioning
  • Arrays & HashingMediumAuto-graded
    Merge Two Sorted Lists Into a Padded Buffer

    Merge a sorted list into the sorted prefix of a larger list that ends with unused slots, writing in place with constant extra memory.

    Arrays & Hashingtwo-pointersin-placesorted-arraysmerge
  • Trees & GraphsMediumAuto-graded
    Group Serialized Tree Values by Depth

    Parse a LeetCode-style level-order array and return values grouped into nested lists by depth, preserving left-to-right order.

    Trees & Graphstreesbfsarrays
  • Arrays & HashingMediumAuto-graded
    Count Close Triplets Within a Value Range

    Tests sorting, sliding window, and combinatorial counting to find how many index-distinct triplets fit within a given value spread.

    Arrays & Hashingsliding-windowsortingcombinatorics
  • Arrays & HashingMediumAuto-graded
    Grid Walk With Clockwise Redirects at Walls and Obstacles

    Tests grid simulation by traversing a matrix in a right-biased clockwise walk that turns at boundaries, visited cells, and blocked positions until no move is possible.

    Arrays & Hashingmatrixsimulationgrid
  • Dynamic ProgrammingHardAuto-graded
    Enumerate All Possible Tic-Tac-Toe Game Paths

    Tests recursive game-tree traversal with memoization to count distinct play sequences by outcome.

    Dynamic Programmingrecursionmemoizationgame-theory
  • Trees & GraphsMediumAuto-graded
    Shared Manager in Organizational Hierarchy

    Tests tree traversal, ancestor queries, and handling multiple input formats with a custom precedence rule.

    Trees & Graphstreeslowest-common-ancestorgraph-traversal
  • Trees & GraphsMediumAuto-graded
    Fill Rooms With Distance to Nearest Exit

    Tests multi-source BFS on a grid to propagate shortest walking distances from all exits simultaneously to every reachable empty room.

    Trees & Graphsbfsgraphsgrid
  • Dynamic ProgrammingMediumAuto-graded
    Longest Strictly Increasing Subsequence

    Tests understanding of dynamic programming optimization using binary search and greedy subsequence construction with the patience sorting technique.

    Dynamic Programmingbinary-searchsubsequencesgreedy
  • Arrays & HashingMediumAuto-graded
    Stable Grouping and Column Gravity

    Tests stable partitioning of categorized strings and simulating gravity on independent grid columns

    Arrays & Hashingarrayssortingsimulationtwo-pointers
  • StringsMediumModel answer
    Aggregate HTTP Logs to Identify Top Client Addresses

    Parse multi-file request logs to extract and rank the five IPv4 addresses that generated the most completed HTTP requests.

    Stringsparsingregexaggregationtop-k
  • Trees & GraphsMediumAuto-graded
    Root-to-Leaf Path Metrics on a Weighted Tree

    Tests whether a candidate can traverse an unordered weighted tree in linear time to extract the root, the heaviest root-to-leaf path weight, and the maximum depth.

    Trees & Graphstrees-graphshash-mapiterative-dfs
  • Arrays & HashingHardAuto-graded
    Estimating the Probability of a Dice Sum Exceeding a Target

    Apply the central limit theorem and continuity correction to approximate the tail probability of a sum of independent discrete random variables.

    Arrays & Hashingprobabilitycentral-limit-theoremnormal-approximationcontinuity-correction
  • Dynamic ProgrammingMediumAuto-graded
    Worst Equity Drop, Best Trade, and Fewest Coins

    Return a series' steepest peak-to-trough drop with its indices, the best one-buy-one-sell gain, and the minimum coin count for a target.

    Dynamic Programmingarraysdynamic-programminggreedysingle-pass
  • Arrays & HashingMediumAuto-graded
    Evaluate Request Status from Rule Matches

    Tests rule-based decision logic with subset matching and outcome priority resolution when multiple rules apply simultaneously.

    Arrays & Hashingset-operationslogicprecedence
  • Greedy & IntervalsMediumAuto-graded
    Fewest Points to Cover a Microdollar Threshold

    Tests greedy selection when items have uniform cost but different values under capacity constraints.

    Greedy & Intervalsgreedysortingmath
  • Data Structure DesignHardModel answer
    Versioned In-Memory Set with Snapshot Iterators and WAL Contracts

    Design an MVCC-backed mutable set with O(1) snapshot iterators and specify the durability, ordering, and crash-recovery contracts for a write-ahead log.

    Data Structure DesignMVCCsnapshot isolationWALdata structure design