KatInterview

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

Interview Practice Problems

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

5972
Problems
2212
Auto-graded
15
Topics
273
Added today

Showing 121–150 of 2212 results

  • Data Structure DesignMediumAuto-graded
    Simulate an Expiring Key-Value Store with Read-Through Loads

    Simulate a time-aware key-value store with expiry, stale entries that stay stored, and a read-through fetch whose loader outcome is given as data, with strict input validation.

    Data Structure Designsimulationhash-mapcachevalidation
  • Data Structure DesignMediumAuto-graded
    Canvas Replay with Undo and Redo History

    Simulate a pixel canvas with draw, erase, flood fill, undo and redo, returning a canvas snapshot after every command while keeping the history stacks consistent.

    Data Structure Designstacksimulationflood-fillundo-redo
  • Trees & GraphsMediumAuto-graded
    Collect Path-Tagged Errors from a Nested Payload Schema Check

    Recursively walk a JSON-like value alongside a simplified schema and report type and missing-key errors with exact paths, in deterministic order.

    Trees & Graphsrecursiondfsjsonvalidation
  • Trees & GraphsMediumAuto-graded
    Count Node Changes Between Two Keyed Hierarchies

    Compare two keyed trees in parallel and count changed nodes, where a changed value replaces its whole subtree and unmatched nodes count with their subtrees.

    Trees & Graphstreedfshash-mapsubtree-size
  • Data Structure DesignMediumAuto-graded
    Point-in-Time Set Views from an Operation Log

    Simulate a set that processes add, remove, contains and snapshot operations, where each snapshot must be an independent frozen copy of the set at that moment.

    Data Structure Designdesignhash-setsnapshotsimulation
  • Data Structure DesignMediumAuto-graded
    Simulate a Fixed-Size Cache Under LRU or LFU Eviction

    Replay a list of get/put operations on a bounded cache that evicts by recency or by frequency (ties broken by recency), and return the result of each operation.

    Data Structure Designhash-mapordered-dictlrulfu
  • Arrays & HashingMediumAuto-graded
    Distinct Value Foursomes Hitting a Target Total

    Find every distinct set of four values, taken from different positions, that add up to a target, with no repeated value combinations in the output.

    Arrays & Hashingtwo-pointerssortingdeduplicationk-sum
  • Arrays & HashingEasyAuto-graded
    Count Shoppers With Visits on Two or More Days

    Group log entries by person and ignore repeats on the same day, then count how many people appear on at least two different calendar days.

    Arrays & Hashinghash-sethash-mapgroupingdeduplication
  • Stacks & QueuesMediumAuto-graded
    Collapse Adjacent Edits Before Applying Them to a Text Buffer

    Simulate a queue of insert and format edits, merging adjacent inserts and dropping repeated adjacent formats, then return the final text and ordered list of applied styles.

    Stacks & Queuesstacksimulationcommand-patternstrings
  • Data Structure DesignMediumAuto-graded
    Ring-Buffer Deque with Constant-Time Indexing

    Build a double-ended queue on a resizable circular array so index lookups are O(1), then replay a command list against it and report each result.

    Data Structure Designcircular-bufferdequedynamic-arrayamortized-analysis
  • Trees & GraphsMediumAuto-graded
    Extract Text From Matching Elements in Messy Markup

    Parse a forgiving HTML string into an element tree in one pass, then collect each matching element's combined text in document order using an iterative depth-first traversal.

    Trees & Graphsparsingtreedfsstack
  • Trees & GraphsMediumAuto-graded
    Total Value of Bit-Strings Along a Tree's Leaf Paths

    Decode a level-order bit tree with skipped None slots, then sum the binary values read along each root-to-leaf path, testing BFS parsing and DFS with a running accumulator.

    Trees & Graphsbinary-treedfsbfslevel-order-parsing
  • Heaps, Sorting & SearchMediumAuto-graded
    Evaluate a Broken-Line Curve at a Query Position

    Sort scattered points by x, then find the y on the connecting line at a query x, interpolating inside the range and extending the end segments outside it.

    Heaps, Sorting & Searchbinary-searchsortinginterpolationgeometry
  • Greedy & IntervalsMediumAuto-graded
    Combine Overlapping Time Intervals

    Consolidate overlapping and adjacent closed intervals into a minimal list of disjoint intervals using sorting.

    Greedy & Intervalsarraysgreedy-intervalssorting
  • Heaps, Sorting & SearchMediumAuto-graded
    Order Transformed Values of a Sorted Array

    Apply a quadratic mapping to a sorted list of numbers and return the sorted results in O(n) time.

    Heaps, Sorting & Searchtwo-pointersarraysmath
  • Trees & GraphsMediumAuto-graded
    Closest-Pair Dispatch of Couriers on a Walled Grid

    Match couriers to parcels by repeatedly choosing the globally closest pair, using BFS shortest paths on a grid with walls and deterministic tie-breaking.

    Trees & Graphsbfsgridgreedysorting
  • Stacks & QueuesMediumAuto-graded
    Normalize a Filesystem Location String

    Reduce an absolute Unix-style path to its canonical form by resolving repeated slashes, current-directory and parent-directory segments, using a stack.

    Stacks & Queuesstackstring-parsingsimulationpaths
  • SQL & DataMediumAuto-graded
    Top Earners per Department with Ties

    Given department and employee tables as lists, return every employee who earns the maximum salary in their department, keeping ties and handling duplicate names.

    SQL & Datagroup-byhash-maptiesjoins
  • Math & Bit ManipulationMediumAuto-graded
    Count Starting Numbers for Consecutive Sums

    Determine how many positive integers can serve as the starting element of a sequence of consecutive positive integers that sums to a target value.

    Math & Bit Manipulationmathnumber-theoryarithmetic-progression
  • Trees & GraphsMediumAuto-graded
    Find the k-th Value in a Level-Order Encoded Tree's Inorder Sequence

    Decode a level-order binary tree with null gaps, then return the k-th value in its inorder sequence, or -1 if fewer than k nodes exist.

    Trees & Graphsbinary-treeinorder-traversaliterative-traversalstack
  • Arrays & HashingMediumAuto-graded
    Cascading Tile Crush on a Grid

    Simulate a tile-crush game: mark all runs of 3+ equal tiles, clear them, drop tiles with gravity, and repeat until stable, counting removed tiles.

    Arrays & Hashingsimulationmatrixtwo-pointersgrid
  • Trees & GraphsMediumAuto-graded
    Inherited Permissions Across a Group Hierarchy

    Answer permission queries over a DAG of groups where each group inherits from its parents, using graph traversal with memoization or caching.

    Trees & Graphsgraphdagdfsmemoization
  • Trees & GraphsMediumAuto-graded
    Best Hub-and-Spokes Value Sum with a Spoke Limit

    Choose a hub node and up to k adjacent nodes to maximize the total node value, which tests per-node greedy selection over adjacency lists.

    Trees & Graphsgraphgreedysortingadjacency-list
  • Dynamic ProgrammingMediumAuto-graded
    Biggest Solid Block in a Binary Grid

    Find the area of the largest square made only of '1' cells in a grid of character digits, using a dynamic programming recurrence that can be compressed to a single row of state.

    Dynamic Programmingdynamic-programmingmatrixspace-optimization2d-grid
  • Stacks & QueuesEasyAuto-graded
    Leftover Brackets After Pairing Up a Parenthesis String

    Count the parentheses left over after forming the maximum number of valid "(" before ")" pairs, testing a greedy counter scan or stack over a string.

    Stacks & Queuesstackgreedystringsparentheses
  • Trees & GraphsMediumAuto-graded
    Reach the Goal State While Avoiding Forbidden Nodes

    Decide whether a goal node can be reached from node 0 in a directed graph without ever stepping on a forbidden node, using BFS or DFS reachability.

    Trees & Graphsgraphbfsreachabilitydirected-graph
  • Trees & GraphsMediumAuto-graded
    First Moment a Cable Network Becomes One Piece

    Replay unsorted timed link events and find the earliest timestamp at which every node is in one connected group, using union-find over events sorted by time.

    Trees & Graphsunion-findgraph-connectivitysortingkruskal
  • Data Structure DesignMediumAuto-graded
    Simulate Stacked Rectangles on a Small Text Canvas

    Simulate add, remove, reorder and render commands on a layered character canvas, resolving overlaps by layer order and clipping shapes at the edges.

    Data Structure Designsimulationordered-dictdesignclipping
  • Greedy & IntervalsMediumAuto-graded
    Most Overlapped Aisle Along a Line of Lamps

    Find the integer position covered by the most symmetric intervals, returning the smallest on ties, using an event sweep over interval endpoints instead of visiting every position.

    Greedy & Intervalssweep-lineintervalsdifference-arraysorting
  • Arrays & HashingMediumAuto-graded
    Zigzag Parity Check on Subarray Ranges

    Answer many range queries asking whether neighbors in a subarray always differ in odd/even parity, using prefix counts of same-parity adjacent pairs.

    Arrays & Hashingprefix-sumrange-queriesparityarrays