KatInterview

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

Interview Practice Problems

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

6035
Problems
2235
Auto-graded
15
Topics
274
Added today

Showing 1081–1110 of 2235 results

  • 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
  • SQL & DataMediumAuto-graded
    Pick the Title Winner from Mixed-Orientation Game Records

    Given team and game record lists, find the 2023 championship winner when the winner may be on either side, with a deterministic highest-score tie-break.

    SQL & Datadata-manipulationjoinsfilteringhash-map
  • Greedy & IntervalsMediumAuto-graded
    Emptying Depots With a Limited Pool of Partner Skips

    Compute the minimum skips each depot needs using modular arithmetic, then greedily pick the cheapest depots under a shared skip budget to maximize emptied depots.

    Greedy & Intervalsgreedymathsortingmodular-arithmetic
  • Trees & GraphsMediumAuto-graded
    Two-Choice Clinic Booking: Can Everyone Get a Slot?

    Decide whether each patient can get one of their two acceptable slots with no slot reused, by modelling slots as graph vertices and patients as edges.

    Trees & Graphsunion-findgraph-modelingmatchingconnected-components
  • Data Structure DesignEasyAuto-graded
    Replay Ledger Commands on a Guarded Account

    Simulate an account that processes a list of deposit, withdraw, balance and history commands, rejecting invalid amounts and overdrafts while recording only successful transactions.

    Data Structure Designsimulationclass-designstate-managementvalidation
  • Math & Bit ManipulationMediumAuto-graded
    Tie-Aware Ranking Probabilities for Three and Four Tasters

    Derive conditional ranking probabilities for i.i.d. scores, with and without ties, and return them as a dictionary keyed by named quantities.

    Math & Bit Manipulationprobabilitycombinatoricsconditional-probabilityclosed-form
  • Arrays & HashingEasyAuto-graded
    Triple Array Toolkit: Lookup, Increment, Zero Shift

    Combines a binary search on a sorted list, adding one to a digit-array number with carry, and a stable in-place move of zeros to the back.

    Arrays & Hashingbinary-searchtwo-pointerscarryin-place
  • Trees & GraphsEasyAuto-graded
    Reporting Chain Length Between Two Employees

    Find the number of links on the path between two people in a company tree given as pairs, which tests undirected graph modeling and BFS or lowest common ancestor reasoning.

    Trees & Graphsgraphbfstreeshortest-path
  • Greedy & IntervalsEasyAuto-graded
    Best Single Buy-Sell Gain from Daily Quotes

    Find the largest gain from buying on one day and selling on a later day in a list of daily prices, returning 0 if no gain is possible.

    Greedy & Intervalsgreedyarraysrunning-minimumsingle-pass
  • SQL & DataMediumAuto-graded
    Daily Tally of Users Who Posted on Their Signup Day

    Given user and post records with timestamps, count per signup date how many users published at least one post that same calendar day, counting each user once.

    SQL & Datahash-mapdatesdedupaggregation
  • Math & Bit ManipulationEasyAuto-graded
    Annual Profit and Break-Even Value for a Lounge Menu Item

    Compute a per-site annual operating result and the break-even per-unit benefit from visit volume, uptake rate, unit cost, unit benefit, a one-time setup cost, and a time horizon.

    Math & Bit Manipulationarithmeticbreak-evensimulationedge-cases
  • Arrays & HashingMediumAuto-graded
    Mean Front-to-Rear Lens Flips Across Recorded Sessions

    Group event logs by session, sort chronologically, count adjacent front-then-rear transitions, and average over all sessions, including sessions with zero flips.

    Arrays & Hashinghash-mapgroupingsortingsimulation
  • Dynamic ProgrammingMediumAuto-graded
    Distinct Value Groups Summing to a Goal, Each Item Used Once

    Enumerate every distinct multiset of values from a list with repeats that adds up to a goal, using each position at most once, via sorted backtracking with duplicate skipping.

    Dynamic Programmingbacktrackingrecursionsortingcombinations
  • Heaps, Sorting & SearchEasyAuto-graded
    Closest Points to a Query Vector, Ranked with Index Tie-Break

    Select the k dataset points nearest to a query in n-dimensional space, ordered by distance, with ties resolved by smaller index.

    Heaps, Sorting & Searchk-nearest-neighborssortingheapeuclidean-distance
  • Trees & GraphsMediumAuto-graded
    Words Traced Through a Letter Board

    Find every dictionary word that can be traced through orthogonally adjacent cells of a letter board without reusing a cell, using backtracking guided by a prefix tree.

    Trees & Graphsbacktrackingtriedfsgrid
  • Arrays & HashingEasyAuto-graded
    Earliest Non-Repeating Event Name in a Sequence

    Find the earliest entry in a list of strings that occurs exactly once overall, or return an empty string, testing frequency counting combined with preserved order.

    Arrays & Hashinghash-mapcountingstringstwo-pass
  • Data Structure DesignMediumAuto-graded
    Admit or Deny Requests Under a Per-Client Rolling Quota

    Process a time-ordered request log and decide per request whether a client is under its quota in a rolling time window, counting only previously admitted requests.

    Data Structure Designsliding-windowdequehash-mapsimulation
  • Arrays & HashingEasyAuto-graded
    Locate the Two Positions That Add Up to a Goal Value

    Find the single pair of distinct positions in an integer list whose values add up to a goal, using a one-pass lookup instead of checking every pair.

    Arrays & Hashinghash-maparraycomplement-lookup
  • Greedy & IntervalsMediumAuto-graded
    Fewest Conference Rooms for a Day of Bookings

    Compute the minimum number of rooms needed to host all time-range bookings when back-to-back bookings may reuse a room, testing sweep-line or heap-based interval reasoning.

    Greedy & Intervalsintervalsheapsweep-linesorting
  • Heaps, Sorting & SearchMediumAuto-graded
    Leftmost Match in a Sorted Sequence Without a Known Size

    Find the first index of a target in a sorted list while the search pretends its length is unknown, using doubling probes followed by a lower-bound binary search.

    Heaps, Sorting & Searchbinary-searchexponential-searchduplicatessorted-array
  • Stacks & QueuesMediumAuto-graded
    Largest Block Under a Skyline of Columns

    Compute the largest rectangle that fits under a row of unit-width columns, testing monotonic stack usage and boundary reasoning over contiguous ranges.

    Stacks & Queuesmonotonic-stackarrayhistogramcontiguous-range
  • Trees & GraphsMediumAuto-graded
    Nearest Exit Distance Map on a Walled Grid

    Compute, for every open cell of a grid with walls and exits, the shortest 4-directional distance to any exit using multi-source BFS, leaving unreachable cells unchanged.

    Trees & Graphsbfsgridmulti-source-bfsmatrix
  • Greedy & IntervalsMediumAuto-graded
    Fewest Drivers to Cover Every Trip Without Overlap

    Find the fewest drivers needed to serve all trips given [start, end) times, which reduces to the peak number of simultaneous trips and tests sweep-line or heap handling of boundaries.

    Greedy & Intervalsintervalssweep-lineheapgreedy
  • Arrays & HashingEasyAuto-graded
    Per-Row Offset From Group Average in a Record List

    Tests group-then-broadcast logic: compute each group's mean over a list of dict records, then attach each row's difference from its group mean while preserving order.

    Arrays & Hashinghash-mapgroup-byaggregationsimulation
  • Greedy & IntervalsMediumAuto-graded
    Find the First Free Slot After Busy Minutes in Text Schedules

    Parse text schedule entries into inclusive minute intervals, merge them, and find the earliest k-minute free slot that follows the first busy minute of the day.

    Greedy & Intervalsintervalsmerge-intervalsstring-parsingsorting
  • Trees & GraphsMediumAuto-graded
    Service Inventory Filter and Dependency Risk Report

    Filter a service inventory by namespace, attributes and status, then compute transitive dependencies and risk flags from a root service, handling cycles and dangling references.

    Trees & Graphsgraph-traversaldfshash-mapfiltering
  • SQL & DataMediumAuto-graded
    Live Stream Creator Stats: Weekly, Monthly Rankings and Daily Check

    Join two record lists on a composite key with missing-row defaults, then compute a filtered distinct count, a per-group top-5 ranking with tie-breaks, and an every-item condition check.

    SQL & Datajoinsgroup-byrankingtie-breaking
  • StringsMediumAuto-graded
    Fewest Source Slices to Spell a Target

    Find the minimum number of source substrings whose concatenation equals the target, using longest-match-per-position and a greedy jump pass.

    Stringsstringsgreedysuffix-automatontwo-pointers
  • Trees & GraphsMediumAuto-graded
    Shortest Route to an Exit with Fixed Direction Priority

    Run BFS on a character grid to return the shortest move sequence to any exit, breaking ties by a fixed U, D, L, R direction priority.

    Trees & Graphsbfsgridshortest-pathpath-reconstruction
  • Math & Bit ManipulationEasyAuto-graded
    Lamps After Divisor Sweeps

    Count how many of n switches end up on after sweeping by every step size, which tests the divisor-parity and perfect-square insight.

    Math & Bit Manipulationmathnumber-theoryperfect-squaresdivisors