KatInterview

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

Coding Interview Problems

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

6002
Problems
2223
Auto-graded
15
Topics
273
Added today

Showing 541–570 of 2123 results

  • 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
  • Data Structure DesignMediumAuto-graded
    Path-Keyed File Store with Per-User Storage Quotas

    Simulate a command stream on an in-memory file store with admin and user-owned files, prefix/suffix search, copying, and quota-driven eviction.

    Data Structure Designhash-mapsimulationsortingdesign
  • Trees & GraphsMediumAuto-graded
    Prune a Branch from a Parent-Array Forest

    Remove a node and its entire subtree from a forest stored as a parent array, either by marking slots with -1 or by compacting indices and remapping parent pointers.

    Trees & Graphsforestdfsparent-arrayreindexing
  • Arrays & HashingMediumAuto-graded
    Waiting-Time Triangle Density: Normalize and Evaluate the CDF

    Normalize a piecewise-linear triangular density to find its constant, then evaluate the resulting piecewise-quadratic cumulative distribution at a list of query points.

    Arrays & Hashingprobabilitycdfpiecewise-functionsintegration
  • Trees & GraphsMediumAuto-graded
    Deterministic Mine Grid Plus Letter-Path Check

    Build a mine-count grid with mines in row-major order, then use DFS backtracking to check whether a word can be traced through a separate letter grid.

    Trees & Graphsgridbacktrackingdfssimulation
  • Data Structure DesignMediumAuto-graded
    Per-User Request Throttle Simulator with Rolling Time Window

    Replay a list of throttle operations and decide, per user, whether each request fits within k accepted requests in a rolling window of t ms, using inclusive boundary rules.

    Data Structure Designsliding-windowdequehash-mapsimulation
  • Dynamic ProgrammingMediumAuto-graded
    Smallest Sentence from a Spaceless String and Word List

    Segment a spaceless string into dictionary words and return the lexicographically smallest valid sentence, or None if impossible; tests suffix DP plus greedy reconstruction.

    Dynamic Programmingdynamic-programmingstringsgreedyword-break
  • Arrays & HashingEasyAuto-graded
    Repair a Sensor Log: Merge, Sort, and Interpolate Gaps

    Merge duplicate timestamps by averaging known readings, sort, then fill missing values by linear interpolation inside gaps and nearest-value holding at the ends.

    Arrays & Hashinghash-mapsortinginterpolationtime-series
  • StringsMediumAuto-graded
    Does This Shorthand Describe the Word?

    Check whether a shorthand of letters and skip counts exactly describes a word, handling multi-digit counts, leading zeros, overruns and leftover characters with a two-pointer scan.

    Stringstwo-pointersstring-parsingsimulation
  • Data Structure DesignMediumAuto-graded
    Word Index with Prefix Queries and Ordered Suggestions

    Simulate a command sequence on a word index that supports insert, exact lookup, prefix lookup, and alphabetically ordered, capped autocomplete, built on a trie.

    Data Structure Designtriedesigndfsstrings
  • Data Structure DesignEasyAuto-graded
    Ledger Simulator with Holds, Deferred Payments and Cancellations

    Simulate a small in-memory bank driven by a command script, covering account creation, instant and deferred transfers, batch settlement and cancellation of pending transfers.

    Data Structure Designsimulationhash-mapstate-managementclass-design
  • Stacks & QueuesEasyAuto-graded
    Check Whether Bracket Pairs Are Correctly Nested

    Decide whether a string of round, square and curly brackets is well formed, which tests the use of a stack for last-in-first-out matching.

    Stacks & Queuesstackstringsparsing
  • Math & Bit ManipulationEasyAuto-graded
    Single Row of the Binomial Triangle in Linear Space

    Compute one row of Pascal's triangle by index, using only space proportional to the row, via an in-place update or the multiplicative binomial recurrence.

    Math & Bit Manipulationpascal-trianglecombinatoricsdynamic-programmingarrays
  • Trees & GraphsMediumAuto-graded
    Tally Separate Clusters of Occupied Cells in a Grid

    Count groups of orthogonally touching '1' cells in a character grid, a connected-components task solved with an iterative flood fill or union-find.

    Trees & Graphsgraphbfsgridconnected-components
  • Data Structure DesignMediumAuto-graded
    Hourly Courier Pay Ledger with Settlement Watermark

    Simulate a payroll ledger that records work intervals, tracks accrued cost, and settles wages up to a cutoff time without double-paying.

    Data Structure Designdesignsimulationintervalsidempotency
  • Arrays & HashingEasyAuto-graded
    Pair Sum Existence Check in an Integer List

    Decide whether any two elements at different positions in an integer list add up to a given value, testing hash-set lookups and careful handling of duplicates.

    Arrays & Hashinghash-settwo-sumarrayscomplement
  • Data Structure DesignMediumAuto-graded
    Replay Commands on a Fixed-Bucket Key-Value Store

    Simulate a hand-built key-value store with a fixed bucket count by replaying a command log, handling collisions and overwrites correctly without a built-in dictionary.

    Data Structure Designhash-tableseparate-chainingsimulationdesign
  • Dynamic ProgrammingMediumAuto-graded
    Longest Eastward Chain of Cities from Raw CSV Text

    Parse CSV text with quoted fields, then find the longest chain of cities with increasing longitude and non-decreasing latitude, breaking ties by the smallest list of names.

    Dynamic Programmingcsv-parsinglongest-increasing-subsequencedag-dplexicographic-tiebreak
  • Data Structure DesignMediumAuto-graded
    Ticket Ranges: Find the Bucket Owning Each Draw

    Map integer draws to the index whose cumulative weight range contains them, using prefix sums and binary search, driven through a batch of init/query operations.

    Data Structure Designprefix-sumbinary-searchdesignbisect
  • Dynamic ProgrammingMediumAuto-graded
    Optimal Closed Tour Cost Across Directed Locations

    Find the minimum cost to complete a full circuit starting and ending at node 0, visiting all other nodes exactly once with asymmetric leg costs.

    Dynamic Programmingdynamic-programmingbit manipulationgraph
  • Data Structure DesignMediumAuto-graded
    Closest Pair Gaps Between Words in a Fixed List

    Answer many closest-index-distance queries over a fixed word list by building a position index, precomputing same-word gaps, and binary searching the smaller list.

    Data Structure Designinverted-indexbinary-searchpreprocessinghash-map
  • Linked ListsMediumAuto-graded
    Flip Every Complete Block of K in a Sequence

    Reverse each full consecutive block of k items in a list, leaving a shorter leftover tail unchanged; tests pointer-style reversal logic and boundary handling.

    Linked Listslinked-listin-place-reversaltwo-pointerssimulation
  • Heaps, Sorting & SearchMediumAuto-graded
    Top K Highest Scores in Descending Order

    Select the k greatest values from an unsorted integer list, duplicates included, returned from largest to smallest, ideally in O(n log k) time using a bounded min-heap.

    Heaps, Sorting & Searchheaptop-ksortingarrays
  • Greedy & IntervalsMediumAuto-graded
    Fewest Brackets to Add for a Balanced String

    Count the fewest parenthesis insertions needed to make a string of brackets balanced, using a single left-to-right pass with a running counter.

    Greedy & Intervalsgreedystringsparenthesescounter
  • Trees & GraphsMediumAuto-graded
    Find Minimum Network Distance Between Users

    Compute the shortest path distance between two nodes in an unweighted undirected graph using Breadth-First Search.

    Trees & Graphsbfsgraphshortest-pathbreadth-first-search
  • Trees & GraphsMediumAuto-graded
    Reconstruct Alphabet Order from Sorted Vocabulary

    Determine character precedence in an unfamiliar alphabet using a sorted list of terms, returning the lexicographically first valid character sequence or an empty string for invalid inputs.

    Trees & Graphstrees-graphsheaps-sortingstrings
  • Dynamic ProgrammingMediumAuto-graded
    Stock Trading With a Per-Sale Commission

    Compute the best total gain from repeatedly buying and selling a single share of a stock when each sale costs a flat commission, using a two-state dynamic program.

    Dynamic Programmingdynamic-programmingstate-machinestocksgreedy
  • Arrays & HashingMediumAuto-graded
    Prefix Value Blocks in a Shuffled Sequence

    Decide, for every k, whether the values 1..k occupy a contiguous block of a permutation, using value positions and a running span instead of scanning subarrays.

    Arrays & Hashingpermutationindex-mappingrunning-min-maxstring-output
  • Dynamic ProgrammingMediumAuto-graded
    Rearrangements of 1..m With a Fixed Number of Out-of-Order Pairs

    Count arrangements of 1..m with exactly n out-of-order pairs, modulo 10^9+7, using a DP over insertion positions optimized with a sliding-window sum.

    Dynamic Programmingdynamic-programmingcombinatoricspermutationssliding-window