KatInterview

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

Interview Practice Problems

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

6033
Problems
2234
Auto-graded
15
Topics
274
Added today

Showing 1051–1080 of 2234 results

  • Heaps, Sorting & SearchEasyAuto-graded
    Rank Advertisers by Reports, Then Report Rate

    Aggregate per-ad records by advertiser, then rank with a multi-key sort (total reports, report rate, id) and return the top k.

    Heaps, Sorting & Searchhashingsortingaggregationcustom-sort-key
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Ore Haul on a Climb-and-Step Grid Route

    Grid dynamic programming: find the route with the largest sum from the bottom-left to the top-right cell when only moving up or right.

    Dynamic Programmingdynamic-programminggridmatrixpath-sum
  • Greedy & IntervalsMediumAuto-graded
    Fewest Vehicles to Cover Back-to-Back Bookings

    Find the peak number of simultaneously active half-open intervals using a sweep line or heap, with correct handling of ties where one booking ends as another begins.

    Greedy & Intervalsintervalssweep-linesortingheap
  • Data Structure DesignMediumAuto-graded
    Parcel Runner Payout Ledger with Peak Overlap Queries

    Simulate a stateful ledger driven by operation lists: track per-runner payout sums and compute maximum simultaneous half-open intervals clipped to a query window.

    Data Structure Designsweep-linehash-mapintervalssimulation
  • Data Structure DesignMediumAuto-graded
    Batch Runner for a Slash-Separated Key Store

    Simulate a hierarchical key store from a batch of create/get commands, where a key can only be created once its parent key already exists.

    Data Structure Designdesignhash-maptriesimulation
  • Trees & GraphsMediumAuto-graded
    Job Scheduling with Cycle Check and Downstream Rerun Set

    Topologically sort jobs with cycle detection, then use graph reachability to find all jobs affected by changed ones and list them in valid order.

    Trees & Graphstopological-sortgraphbfscycle-detection
  • Greedy & IntervalsMediumAuto-graded
    Sequential Allow/Deny Rules Over an IPv4 Block

    Track an IPv4 block as disjoint integer intervals while applying ordered allow and deny CIDR rules, deciding whether the block ends up fully covered with no deny hit.

    Greedy & Intervalsintervalsipv4cidrsimulation
  • Data Structure DesignMediumAuto-graded
    Healthy Region Registry and Nearest-Site Router

    Simulate a command interpreter that registers sites, toggles their health, and answers nearest-healthy-site queries by great-circle distance, with strict validation and tie-breaking.

    Data Structure Designsimulationstring-parsinghash-mapvalidation
  • Arrays & HashingEasyAuto-graded
    Yearly Account Balance with Conditional Monthly Service Charges

    Simulate a year of account activity, applying a flat monthly charge unless a month has enough payments with a large enough total, and return the final balance.

    Arrays & Hashingsimulationhash-mapaggregationconditional-logic
  • Greedy & IntervalsMediumAuto-graded
    Courier Earnings from Overlapping Order Events

    Sweep over unsorted start/end events to total concurrency-weighted seconds, validate malformed input, and convert to a half-up rounded dollar string.

    Greedy & Intervalsinterval sweepevent sortingvalidationexact arithmetic
  • Data Structure DesignEasyAuto-graded
    Most Likely Follower Lookup Over Streaming Sentences

    Process a stream of add and query operations over sentences, tracking adjacent-word counts and returning the most frequent follower with lexicographic tie-breaking.

    Data Structure Designhash-mapstringssimulationcounting
  • StringsEasyAuto-graded
    Report SQL Clauses in Conceptual Evaluation Order

    Detect which of six SQL clauses appear in a query string and return them in SQL-92 logical evaluation order, using case-insensitive whole-word matching.

    Stringsstringsregexsqlparsing
  • StringsMediumAuto-graded
    Mask the Leftmost Longest Keyword in a Text

    Find the earliest-starting match among several keywords, prefer the longest at that spot, and collapse it into a single placeholder character.

    Stringsstringsstring-matchingsimulationtrie
  • Heaps, Sorting & SearchMediumAuto-graded
    Replay Commands to Track a Running Median

    Replay a list of insert and query commands on a growing multiset of integers, reporting the median at each query; tests two-heap or order-statistic maintenance.

    Heaps, Sorting & Searchheapstreamingmediandesign
  • Data Structure DesignMediumAuto-graded
    Weighted Prefix Suggestion Engine via Command Replay

    Replay a list of add and search commands on a weighted word store, returning the top-k prefix matches ranked by weight, then alphabetically.

    Data Structure Designtrieprefix-searchheaphash-map
  • Math & Bit ManipulationMediumAuto-graded
    Chance of a Red Majority When Skipping Returned Marbles

    Compute a probability for a draw process with discarded-and-returned items by reducing it to a hypergeometric count, ignoring the irrelevant returned category.

    Math & Bit Manipulationprobabilitycombinatoricshypergeometricmath
  • Trees & GraphsHardAuto-graded
    Fewest Rounds to Slay a Scripted Boss With One Revive

    Find the minimum number of rounds to defeat a boss that attacks on a repeating script, using state-space BFS over boss HP, player HP, revive flag, and script position.

    Trees & Graphsbfsstate-space-searchsimulationshortest-path
  • Data Structure DesignMediumAuto-graded
    Replay a Log on a Budgeted Recency Cache

    Simulate a least-recently-used cache whose budget is the sum of per-entry sizes, replaying an operation log and returning each result, using hashing plus recency ordering.

    Data Structure Designlru-cacheordered-dicthash-mapsimulation
  • Trees & GraphsMediumAuto-graded
    List Every Non-Repeating Route in a Directed Graph

    Enumerate all routes from a source to a target in a directed graph that never revisit a node, returned in lexicographic order, using backtracking DFS.

    Trees & Graphsgraphdfsbacktrackingrecursion
  • Trees & GraphsMediumAuto-graded
    Left-Packed Tree Check from a Level-Order Array

    Decide whether a binary tree given as a level-order array with None placeholders is complete, by rebuilding it and scanning breadth-first for a node that follows a gap.

    Trees & Graphsbinary-treebfslevel-ordertree-construction
  • Arrays & HashingMediumAuto-graded
    Forced Winner in Complete and Incomplete Card Hands

    Rank five-card hands with a tuple key, then decide whether an outcome is forced across all ways to fill in missing cards.

    Arrays & Hashingsimulationcombinatoricscountingtie-breaking
  • Trees & GraphsMediumAuto-graded
    Open One Wall to Speed Up Multi-Source Spread

    Use multi-source BFS and brute force over single wall removals to minimize the time until every target is reached, with strict-improvement tie-breaking.

    Trees & Graphsbfsgridmulti-source-bfsbrute-force
  • SQL & DataEasyAuto-graded
    Sum Open Credit Balances per Customer, Sorted by ID

    Filter records by a status value, total a numeric field per customer ID, and return the results sorted by ID, mirroring a SQL filter, group and order query in Python.

    SQL & Datahash-mapaggregationgroup-bysorting
  • Stacks & QueuesMediumAuto-graded
    Checkout Totals After Next Cheaper Coupon Item

    Find, for each element, the nearest later value that is less than or equal to it and subtract it, which tests monotonic stack reasoning on arrays.

    Stacks & Queuesmonotonic-stackarraysnext-smaller-element
  • Data Structure DesignMediumAuto-graded
    Fleet Billing Ledger With Time-Dated Per-Minute Rates

    Simulate a bike-fleet billing ledger where each ride is priced at the rate active at its start, with rate changes, duplicate ride ids and an exact total.

    Data Structure Designdesignsimulationbinary-searchdecimal-arithmetic
  • Math & Bit ManipulationEasyAuto-graded
    Feed Ad Load: Random Slots vs. Fixed Block Quota

    Compute expected ad counts for two feed ad policies and the chance of seeing at least one ad in a window, using linearity of expectation and the complement rule.

    Math & Bit Manipulationprobabilityexpectationmathcomplement-rule
  • Data Structure DesignMediumAuto-graded
    Three Mini Simulations: Case Folding, Aligned Allocator, Run Counter

    Solve three independent simulations: case-insensitive adjacent changes, an 8-aligned memory allocator, and online counting of same-color runs on a line.

    Data Structure Designsimulationstringshash-mapstate-maintenance
  • Data Structure DesignMediumAuto-graded
    Square Grid Line-Completion Referee

    Process a batch of moves on an n x n two-player grid and report after each move whether the mover has completed a full row, column, or diagonal, using constant-time per-move bookkeeping.

    Data Structure Designdesignsimulationcountingmatrix
  • Trees & GraphsMediumAuto-graded
    Surviving Tree Height and Extra Removals to Meet a Limit

    Compute the height of a tree after removing marked nodes (cutting off their subtrees), then find the fewest extra removals needed to bring the height within a limit.

    Trees & Graphstreedfsiterative-traversalheight
  • Data Structure DesignMediumAuto-graded
    LRU Store with Rolling Mean Over Recent Writes

    Simulate a batch of operations on an LRU key-value store that also tracks a rolling mean of the last k written values, with O(1) per operation.

    Data Structure Designlru-cachehash-mapdequesliding-window