KatInterview

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

Interview Practice Problems

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

5991
Problems
2219
Auto-graded
15
Topics
270
Added today

Showing 391–420 of 2219 results

  • Stacks & QueuesMediumAuto-graded
    Parenthesized Integer Calculator with Unary Negation

    Evaluate an integer expression with +, -, *, /, parentheses and unary minus in one iterative pass, using precedence rules and division that truncates toward zero.

    Stacks & Queuesstackparsingexpression-evaluationshunting-yard
  • Trees & GraphsMediumAuto-graded
    Locked Gates Grid: Fewest Steps With Collected Keys

    Find the fewest moves through a grid where lowercase cells give keys and uppercase cells are gates, using BFS over position plus the set of collected keys.

    Trees & Graphsbfsgridstate-space-searchkeys-and-doors
  • Trees & GraphsMediumAuto-graded
    Reconstruct Hierarchical Execution Trees from Trace Records

    Reassemble an unordered collection of trace span objects into a forest of child-linked execution trees sorted chronologically.

    Trees & Graphstreeshash-tablesortinggraph
  • Data Structure DesignMediumAuto-graded
    Resumable Batch Reader for a Linked Page Feed

    Simulate a stateful reader that serves batches of N items in order from a chained page feed, buffering surplus items and handling empty pages, loops and the end of the feed.

    Data Structure Designdesignpaginationbufferingsimulation
  • StringsMediumAuto-graded
    Tally Slices Whose Letters Are All Different

    Count every contiguous slice of a lowercase string in which no letter appears twice, using a linear-time sliding window.

    Stringssliding-windowtwo-pointersstringscounting
  • Data Structure DesignMediumAuto-graded
    Replay Bounded Cache Commands with Recency Eviction

    Simulate a fixed-capacity key-value store that evicts its stalest entry, replaying a command log in O(1) per step using a hash map and recency ordering.

    Data Structure Designlru-cachehash-mapdoubly-linked-listsimulation
  • Data Structure DesignMediumAuto-graded
    Replay a Recency-Evicting Cache from a Command Log

    Simulate a fixed-size cache that evicts the least recently used entry, by replaying text commands and collecting the answers to lookups in order.

    Data Structure Designlru-cachehash-mapordered-dictsimulation
  • Data Structure DesignMediumAuto-graded
    Replay Operations on a Bounded Recency-Evicting Store

    Simulate a fixed-size key-value store that evicts the stalest entry, replaying a list of get/put commands and returning each command's result.

    Data Structure Designhash-maplinked-listordered-dictsimulation
  • Trees & GraphsEasyAuto-graded
    Group Hierarchy Members by Depth Level

    Construct an adjacency graph from reporting links and perform a level-order traversal to group node IDs by depth.

    Trees & Graphstrees-graphsbfshash-map
  • Greedy & IntervalsMediumAuto-graded
    Minimum Time Slots for Cooldown-Constrained Jobs

    Compute the shortest timeline needed to run labeled jobs when equal labels must be separated by a cooldown, using frequency counting and a greedy frame argument.

    Greedy & Intervalsgreedycountingschedulingmath
  • Math & Bit ManipulationMediumAuto-graded
    Two-Segment Rider Model: Weekly Activity, Posterior, Forecast

    Compute three probabilities from a two-group mixture model: at-least-one-success over n days, a Bayesian posterior after all-success streaks, and a posterior predictive forecast.

    Math & Bit Manipulationprobabilitybayesmixture-modelcomplement-rule
  • Trees & GraphsMediumAuto-graded
    Best Plot After Reclaiming a Single Water Tile

    Find the largest connected land region achievable by turning at most one water cell into land, which tests component labeling and merging neighbors without double counting.

    Trees & Graphsgridflood-fillconnected-componentsdfs
  • Trees & GraphsMediumAuto-graded
    Two Teams With Rival Pairs Kept Apart

    Decide whether a set of people can be placed into two teams so that no rival pair shares a team, which tests graph 2-coloring across possibly disconnected components.

    Trees & Graphsgraphbipartitebfscoloring
  • Data Structure DesignMediumAuto-graded
    Simulate a Cursor Editor with Sticky-Column Vertical Moves

    Replay a log of editor commands (type, backspace, move in four directions, render) on a single-cursor multi-line buffer, with a column that persists across vertical moves.

    Data Structure Designsimulationdesigncursorstrings
  • Data Structure DesignMediumAuto-graded
    Versioned Key-Field Store with Expiry and Time Travel

    Simulate a timestamped two-level store with expiring values, conditional updates, sorted prefix scans and historical lookups, driven by a batch of operations.

    Data Structure Designdesignhash-mapbinary-searchttl
  • Trees & GraphsMediumAuto-graded
    Render a Nested Folder Structure as Indented Lines

    Traverse a nested dictionary tree in pre-order, tracking depth to build indented lines with a fixed marker, preserving the given child order.

    Trees & Graphstree-traversaldfsstackstrings
  • Math & Bit ManipulationHardAuto-graded
    Count Substrings Rearrangeable into Palindromes

    Given a list of strings, count the number of contiguous substrings in each string whose characters can be permuted to form a valid palindrome.

    Math & Bit Manipulationbit-manipulationhash-tablestringsprefix-sum
  • StringsMediumAuto-graded
    Rolling Up Page Views Through Hostname Suffixes

    Aggregate per-host view counts so every host and each of its parent suffixes gets the total of itself and all hosts beneath it, using suffix enumeration and a hash map.

    Stringshash-mapstringsparsingsuffix-enumeration
  • Arrays & HashingEasyAuto-graded
    Determine Highest Single Transaction Stock Profit

    Find the maximum gain possible from buying and selling a stock once, given a sequence of daily values.

    Arrays & Hashingarraysgreedydynamic-programming
  • SQL & DataMediumAuto-graded
    Find Bottom Three Active Regions by Unique User Count

    Aggregate user log data to calculate distinct active users per country in 2023, then return the 3 least active countries.

    SQL & Dataarrayshash-tablesortingaggregation
  • Heaps, Sorting & SearchMediumAuto-graded
    Smallest Conveyor Load Limit for Sequential Parcels

    Find the minimum per-day load limit that moves an ordered list of parcels in at most a given number of days, using binary search on the answer with a greedy feasibility check.

    Heaps, Sorting & Searchbinary-searchgreedysearch-on-answerarrays
  • StringsEasyAuto-graded
    Encode Keypad Multi-Tap Strokes

    Simulate telephone keypad multi-tap text encoding while inserting pause delimiters for consecutive letters on the same digit key.

    Stringsstringshash-tablesimulation
  • Arrays & HashingMediumAuto-graded
    Subarrays Whose Matching-Element Count Hits a Residue

    Count subarrays where the number of elements congruent to a residue, taken modulo the same base, equals that residue, using prefix remainders and a frequency table.

    Arrays & Hashingprefix-sumhash-mapmodular-arithmeticsubarrays
  • StringsMediumAuto-graded
    Validate a Plain Signed Decimal Literal

    Check whether a string is a well-formed plain decimal literal (optional sign, digits, optional fraction) by turning a small grammar into a careful single-pass validator.

    Stringsstringsparsingvalidationedge-cases
  • Arrays & HashingMediumAuto-graded
    Monthly Signup Cohorts: Day-30 Return Rate

    Group users by first-activity month and compute the share who return exactly 30 days later, excluding users whose day 30 lies beyond the last observed date.

    Arrays & Hashinghash-mapdatescohort-analysisgrouping
  • StringsEasyAuto-graded
    Reassemble Framed Messages from Chunked Byte Streams

    Join byte chunks from a simulated stream and split them into complete messages, using either a 4-byte length prefix or newline delimiters, while ignoring any incomplete tail.

    Stringsbyte-streamparsingframingbuffering
  • Heaps, Sorting & SearchEasyAuto-graded
    Sort Array and Compute Unique Intersection

    Tests implementing custom merge sort to sort an array and finding the sorted unique intersection of two lists.

    Heaps, Sorting & Searchsortingmerge-sorthash-setarrays
  • StringsMediumAuto-graded
    Evaluate a Nested Let/Add/Mult Expression, or Report Invalid

    Tokenize, validate and evaluate a small Lisp-like language with scoped let bindings, returning None for any malformed or ill-formed input.

    Stringsparsingrecursionscopestring-processing
  • Trees & GraphsMediumAuto-graded
    Can Every Module in a Study Plan Be Finished?

    Decide whether a set of ordering rules between numbered modules contains a circular dependency, by detecting a cycle in a directed graph.

    Trees & Graphsgraphtopological-sortcycle-detectionbfs
  • Trees & GraphsMediumAuto-graded
    Minimum Degrees of Separation in a Social Network

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

    Trees & Graphsbfsgraphshortest-pathhash-map