KatInterview

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

Coding Interview Problems

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

6000
Problems
2221
Auto-graded
15
Topics
272
Added today

Showing 511–540 of 2121 results

  • Arrays & HashingMediumAuto-graded
    Match Cells by Four-Way Gap to Nearest Blocker

    Compute, for every empty cell, the gap to the nearest blocker in each of four directions using linear sweeps, then return the cells whose four gaps equal a given target.

    Arrays & Hashinggridmatrixprefix-sweepsimulation
  • Arrays & HashingMediumAuto-graded
    Assign Persistent Table Column Identifiers

    Process sequential database schema snapshots to assign permanent, case-insensitive unique column aliases with automatic collision resolution.

    Arrays & Hashingarraysstringsdesign-ds
  • Trees & GraphsMediumAuto-graded
    Rebuild a Nested Menu Tree from Indented Text

    Parse an indentation-based, pipe-delimited menu into a nested tree of dictionaries, testing stack-based hierarchy reconstruction and careful field parsing.

    Trees & Graphstree-constructionstackparsingstrings
  • Arrays & HashingEasyAuto-graded
    Keep First Record Per Login ID in Linear Time

    Filter a list of record dictionaries so only the first record for each identifier remains, preserving order and doing it in a single linear pass with a hash set.

    Arrays & Hashinghash-setdeduplicationarraysorder-preservation
  • Greedy & IntervalsEasyAuto-graded
    Partition Array Under Segment Capacity Limit

    Determine the minimum number of contiguous segments needed to split an array such that no segment's total sum exceeds a specified capacity limit.

    Greedy & Intervalsarraysgreedy
  • Arrays & HashingMediumAuto-graded
    Find Unique Integer Triplets Summing to Target

    Finds all unique value triplets in an integer array that sum to a specified target using sorting, two-pointer scanning, and pruning.

    Arrays & Hashingarraystwo-pointerssortingdeduplication
  • Heaps, Sorting & SearchMediumAuto-graded
    Longest Equal Cable Segment From Spools

    Find the largest integer segment length such that cutting every spool into equal segments yields at least k segments, using binary search on a monotonic feasibility check.

    Heaps, Sorting & Searchbinary-searchbinary-search-on-answermonotonic-predicatearrays
  • Trees & GraphsEasyAuto-graded
    Nearest Node in a Binary Search Tree

    Find the value in a Binary Search Tree represented as a level-order array that has the smallest absolute difference to a target number.

    Trees & Graphstrees-graphsbinary-search-treesearch
  • Trees & GraphsMediumAuto-graded
    Fewest Moves Through a Walled Maze

    Compute the minimum number of 4-directional moves between two open cells of a binary maze, or -1 if unreachable; tests breadth-first search on an implicit grid graph.

    Trees & Graphsbfsgridshortest-pathgraph
  • StringsMediumAuto-graded
    Order Distinct Letters-Only Tokens by Popularity

    Extract case-insensitive ASCII-letter tokens from text, count them, and list the distinct words by descending count with alphabetical tie-breaks.

    Stringshash-mapstring-parsingsortingfrequency-count
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Credit Card Portfolio Metrics and Partnership Break-Even

    Computes the annual net contribution per card, overall portfolio profit, and the minimum number of new accounts needed to cover a marketing campaign.

    Math & Bit Manipulationmathfinancial-modelingarithmetic
  • Heaps, Sorting & SearchMediumAuto-graded
    Route Jobs to Workers with Account Stickiness

    Simulate FIFO dispatch of tasks to workers with a preference for each account's last worker, using heaps and a lookup table to track free and busy workers.

    Heaps, Sorting & Searchheapsimulationschedulinghash-map
  • Data Structure DesignMediumAuto-graded
    Earliest Non-Repeating ID in a Live Feed Replay

    Replay a sequence of operations on a stream of integer IDs and report, at each query, the earliest-arriving ID seen exactly once, using a hash map plus an ordered queue.

    Data Structure Designhash-mapqueuedesignstreaming
  • Arrays & HashingEasyAuto-graded
    Find All Top-Frequency Labels Without Using max()

    Count items by their string form and return every label tied for the highest count, in first-appearance order, without calling max().

    Arrays & Hashinghash-mapcountingfrequencyties
  • Heaps, Sorting & SearchMediumAuto-graded
    Group and Rank Feed Items with Photo Bundling

    Rearrange feed items by sorting on rank score, grouping photos into batches of up to three, and maintaining stable ordering for equal scores.

    Heaps, Sorting & Searchsortingarraysbatching
  • Data Structure DesignMediumAuto-graded
    Batch Autocomplete Lookup Over a Dictionary of Words

    Answer many prefix queries against a word list, returning sorted distinct matches for each, using sorting and binary search or a trie instead of rescanning the list per query.

    Data Structure Designbinary-searchtriesortingstrings
  • Linked ListsEasyAuto-graded
    Combine Two Sorted Sequences

    Merge two non-decreasing sequences into a single sorted sequence, maintaining stable order on equal values.

    Linked Liststwo-pointerslinked-listarrayssorting
  • Arrays & HashingMediumAuto-graded
    Possible Minimum Excluded Values After One Increment

    Find all possible values of the minimum non-negative excluded integer (MEX) achievable after at most one element increment.

    Arrays & Hashingarrayshash-tablefrequency-arraymath
  • Data Structure DesignEasyAuto-graded
    Log Event Processor with Time Order

    Tests data structure management and stable sorting to process out-of-order time-stamped events while preserving insertion order for ties.

    Data Structure Designsortingdata-structuresdesign
  • Greedy & IntervalsMediumAuto-graded
    Longest Streak of Growing Daily Distinct Picks

    Find how many days a growing-size distinct-item picking schedule can run, using binary search on the answer plus a capacity feasibility check.

    Greedy & Intervalsgreedybinary-searchprefix-sumsfeasibility-check
  • Greedy & IntervalsHardAuto-graded
    Simulate Trading Order Fill Rate Limit

    Simulate order executions under a time-windowed volume participation constraint using a sliding window.

    Greedy & Intervalssliding-windowqueuegreedytime-series
  • Trees & GraphsMediumAuto-graded
    Validate Binary Tree from Directed Edge List

    Evaluates tree properties, cycle detection, edge validity, and in-order traversal under strict error precedence.

    Trees & Graphstreesgraphsdfstraversal
  • Greedy & IntervalsMediumAuto-graded
    Collapse Booking Windows into Non-Touching Blocks

    Merge inclusive ranges that share at least one point into a sorted list of disjoint ranges, testing sorting, a linear sweep, and correct handling of touching endpoints and nesting.

    Greedy & Intervalsintervalssortingsweepgreedy
  • Data Structure DesignMediumAuto-graded
    Rate-Limited Dispatcher: Which Requests Fire and When

    Simulate a rate limiter with a fixed lockout window that keeps only the newest waiting request, using event-driven processing and a precise rule for requests landing exactly at window end.

    Data Structure Designsimulationevent-driventhrottletwo-pointers
  • StringsEasyAuto-graded
    Name the CSS Function for Red-Green-Blue With Optional Alpha

    Recall which CSS color function takes red, green and blue channels plus an optional opacity value, and return its canonical name as a string.

    Stringscssfundamentalstriviastring-return
  • Data Structure DesignMediumAuto-graded
    Process LFU Cache Operations with Frequency and Recency Eviction

    Simulate a Least Frequently Used (LFU) cache supporting fast O(1) operations, breaking tie frequencies by least recent usage.

    Data Structure Designdesign-dsarrayshash-table
  • Greedy & IntervalsMediumAuto-graded
    Largest Group Anchored by One Overlapping Interval

    Find the largest set of intervals that all intersect one chosen anchor interval, using sorting and binary search to beat quadratic time.

    Greedy & Intervalsintervalsbinary-searchsortingcounting
  • Data Structure DesignMediumAuto-graded
    Running Median Tracker Over an Operation Log

    Process a log of insert and query operations on an integer stream, returning the current median for each query, using two heaps for efficient updates.

    Data Structure Designheaptwo-heapsstreamingmedian
  • Data Structure DesignMediumAuto-graded
    Subscription Filter Matching with Ordered Delivery

    Simulate a message router that matches nested JSON events against per-queue filter policies and returns matching queues in first-subscription order.

    Data Structure Designdesignhash-mapjsonsimulation
  • Heaps, Sorting & SearchEasyAuto-graded
    Find the Slot for a Value in a Sorted List of Distinct Integers

    Tests explicit binary search on a sorted array: find a value's index or the position where it would be inserted, in logarithmic time.

    Heaps, Sorting & Searchbinary-searchsorted-arrayarraystwo-pointers