KatInterview

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

Coding Interview Problems

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

6008
Problems
2226
Auto-graded
15
Topics
274
Added today

Showing 661–690 of 2780 results

  • 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
  • Data Structure DesignMediumModel answer
    Concurrent Micro-Batching Writer with Backpressure and Timed Flush

    Build a thread-safe buffer that accepts records from many producers and writes them to a database in batches, triggered by size, age of the oldest record, or shutdown, without holding locks during I/O.

    Data Structure Designconcurrencycondition-variablesbackpressurebatching
  • 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
  • Data Structure DesignMediumModel answer
    Build a Shutdown-Aware Producer/Consumer Queue in C++

    Design a generic, thread-safe C++ queue where consumers block when it is empty and a shutdown call releases every waiting thread once the remaining items are drained.

    Data Structure Designcppconcurrencymutexcondition-variable
  • Heaps, Sorting & SearchMediumModel answer
    Exact Mode, Median and Balanced Sort Over Ten Message-Passing Nodes

    Integers live on ten machines that can only exchange messages. Write per-node programs for the exact mode, the median and a balanced global sort while sending as little data as possible.

    Heaps, Sorting & Searchdistributed-systemsmapreducesample-sortselection
  • 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
  • Data Structure DesignMediumModel answer
    Expiring Store, Reversible Actions, and Org Chart Walk

    Three short design-and-code tasks: a key-value store with per-entry lifetimes and background pruning, an action history with undo/redo, and a depth-first walk over a hierarchy.

    Data Structure Designcachettlmin-heapundo-redo
  • Data Structure DesignMediumModel answer
    Photo Slideshow with Ranked Comment Threads and Safe Voting

    Design a slideshow widget plus per-photo comment threads with idempotent voting and fast top-k ranking, scaling to 10^5 photos and 10^6 comments.

    Data Structure Designdata-structure-designsorted-indexidempotencypagination
  • 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
  • Data Structure DesignEasyModel answer
    Python Tuples, Dict Internals, and Error Handling in a Record Store

    Answer three fundamentals questions: tuple rebinding and shallow immutability, how a hash table handles insert, lookup, update and delete, and where to raise and catch errors in a record class.

    Data Structure Designpythonimmutabilitytupleshash-table
  • 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
  • Math & Bit ManipulationMediumModel answer
    Eight Number Puzzles: Spot the Rule, Predict the Next Value

    Work out the hidden rule behind eight short numeric and fractional sequences, state the next term for each, and justify it against every given term.

    Math & Bit Manipulationsequencespattern-recognitionrecurrence-relationsmental-math
  • 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
  • StringsMediumModel answer
    Stream Data Processing with Early Cutoff on Sequence Detection

    Yield data from a continuous stream of string fragments, terminating immediately when a specific multi-character sequence is identified across fragment boundaries.

    Stringsstringssliding-windowtwo-pointerskmp
  • Trees & GraphsHardModel answer
    Fastest Route Through Only the Courses a Goal List Needs

    Given courses with durations, prerequisite links and a list of goal courses, compute the minimum time to finish the goals and their needed prerequisites, as total effort and as elapsed time.

    Trees & Graphsgraphtopological-sortdagcycle-detection
  • Data Structure DesignMediumModel answer
    Coalescing Single-Key Reads into Timed Batch Requests

    Build a callback-driven client that gathers individual key requests into one batched GET every 100 ms, using only a timer and an async HTTP primitive, while keeping overlapping batches isolated.

    Data Structure Designevent-loopbatchingcallbackstimers
  • 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