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 1171–1200 of 2234 results

  • Trees & GraphsHardAuto-graded
    Semester Planner Plus Burst-Limited Request Filter

    Combine topological ordering to find the minimum number of semesters (or detect a cycle) with a deque-based simulation of a two-rule request throttle that reports dropped timestamps.

    Trees & Graphstopological-sortgraphcycle-detectionsliding-window
  • StringsMediumAuto-graded
    Locate the First Occurrence of a Needle in a Haystack

    Find the earliest starting index of a pattern inside a text in linear time, handling empty inputs and repetitive patterns, using a prefix-function (KMP-style) scan.

    Stringsstringskmptwo-pointerspattern-matching
  • Greedy & IntervalsMediumAuto-graded
    Peak Concurrent Shifts Across Half-Open Time Ranges

    Find the largest number of half-open time ranges that overlap at one instant, handling shared endpoints, empty ranges and large inputs with a sweep over sorted boundaries.

    Greedy & Intervalssweep-lineintervalssortinghash-map
  • StringsEasyAuto-graded
    Tally Clean Tokens in a Space-Delimited Line

    Split a line on spaces and count the tokens made only of ASCII letters and the marks , . ? !, testing exact tokenization and character-class checks.

    Stringsstringsparsingtokenizationhash-set
  • Arrays & HashingEasyAuto-graded
    Experiment Sizing and Beta Posterior Update

    Compute the per-group sample size for a two-proportion test from a given formula, and update a Beta prior with observed Bernoulli outcomes.

    Arrays & Hashingstatisticspower-analysisbayesian-updatebeta-binomial
  • Data Structure DesignMediumAuto-graded
    Closest Repeat Distance with Fast Threshold Queries

    Precompute the smallest distance between equal values in an array once, then answer many "repeat within k" and "closest repeat" queries in constant time each.

    Data Structure Designhash-mappreprocessingbatch-queriesarrays
  • Math & Bit ManipulationEasyAuto-graded
    Equal-Sized Uniform Piles From a Card Collection

    Decide whether a multiset of integers can be split into uniform piles that all share one common size of at least two, testing counting and the GCD insight.

    Math & Bit Manipulationgcdhash-mapcountingnumber-theory
  • Arrays & HashingEasyAuto-graded
    Top Five Senders and Receivers From Signed Transfer Logs

    Count senders and receivers from signed transfer records in a single pass, then pick the five most frequent on each side with a deterministic tie-break.

    Arrays & Hashinghash-mapcountingheapstreaming
  • Data Structure DesignMediumAuto-graded
    Simulate a Four-Seat Trick-Taking Card Game with Scoring

    Simulate a full 13-trick, four-player card game with deterministic dealing, follow-suit rules, and point scoring, and return the complete game record.

    Data Structure Designsimulationstate-managementsortinghash-map
  • Data Structure DesignMediumAuto-graded
    Count-Feature Text Classifier via Command Replay

    Simulate a stateful multinomial Naive Bayes model driven by fit and predict commands, using smoothed log-probabilities and a deterministic tie-break.

    Data Structure Designnaive-bayessimulationlog-probabilitiessmoothing
  • Math & Bit ManipulationEasyAuto-graded
    Mean of a Numeric List with Empty-Input Fallback

    Compute the arithmetic mean of a list of numbers, returning 0 for an empty list, testing basic edge-case handling and complexity reasoning.

    Math & Bit Manipulationarraysmathedge-cases
  • Arrays & HashingMediumAuto-graded
    Interleave Signs With Stable Order and Trailing Zeros

    Build a new list that alternates positives and negatives (starting positive), keeps same-sign order, appends leftover elements, and places zeros last.

    Arrays & Hashingarraystwo-pointersstable-partitionsimulation
  • Data Structure DesignMediumAuto-graded
    Versioned Lookup Store with Inclusive Range Event Tally

    Simulate a batch of commands on a per-key timestamped value history and an event log, using binary search for point-in-time lookups and inclusive range counts.

    Data Structure Designbinary-searchhash-mapdesignsimulation
  • StringsMediumAuto-graded
    Fewest Edits to a Repeating Palindromic Pattern

    Find the minimum character edits so a string becomes both a palindrome and a repetition of a length-k block, by grouping positions into forced-equal classes.

    Stringsstringspalindromeperiodicityequivalence-classes
  • Data Structure DesignMediumAuto-graded
    Recency-Evicting Cache Simulator

    Simulate a fixed-capacity key-value store that evicts the least recently used entry, processing a batch of get and put commands in constant time each.

    Data Structure Designhash-mapdoubly-linked-listlru-cachesimulation
  • Math & Bit ManipulationMediumAuto-graded
    Correlation Bounds, Equicorrelated Triples, and Box-Muller Sampling

    Compute a feasible correlation interval, give coefficients for three equally anti-correlated variables, and convert uniform values to normals with the Box-Muller transform.

    Math & Bit Manipulationprobabilitycorrelationbox-mullersimulation
  • Greedy & IntervalsMediumAuto-graded
    Courier Earnings from Overlapping Order Timelines

    Sweep over unsorted accept/fulfill events to total a courier's earnings, where pay per minute scales with the number of simultaneously open orders.

    Greedy & Intervalssweep-linesortingintervalssimulation
  • Arrays & HashingMediumAuto-graded
    Target-Sum Windows and Largest Building Cluster

    Combine a prefix-sum hash map to count contiguous slices summing to a target with a grid flood fill to find the largest 4-connected cluster of buildings.

    Arrays & Hashingprefix-sumhash-mapflood-fillgrid
  • Arrays & HashingMediumAuto-graded
    Peak Pace Over Tightest 1000-Meter Windows in Interval Logs

    Sliding-window problem: for each end index find the shortest suffix with at least 1000 meters, compute its average speed, and return the maximum across all end indices.

    Arrays & Hashingsliding-windowtwo-pointersprefix-sumsarrays
  • Arrays & HashingEasyAuto-graded
    Roster Screening with Optional Age, Pay, and Job Limits

    Scan a list of employee records and keep those meeting every enabled optional range or membership rule, preserving order and leaving the input untouched.

    Arrays & Hashingfilteringhash-setoptional-parameterssimulation
  • Trees & GraphsMediumAuto-graded
    Live Archipelago Counter with Incremental Land Reclamation

    Count 4-connected land regions in a grid, then report the updated region count after each cell is converted from water to land, using incremental connectivity.

    Trees & Graphsunion-findgridconnected-componentsincremental-updates
  • Greedy & IntervalsMediumAuto-graded
    Booked Time and Peak Room Demand for a Schedule

    Compute the total time covered by a set of half-open intervals and the maximum number of simultaneously active intervals, ignoring empty or reversed ones.

    Greedy & Intervalsintervalssweep-linesortingmerge-intervals
  • Arrays & HashingMediumAuto-graded
    Batch Gradient Descent Linear Regression Session Simulator

    Simulate a fit/predict command sequence for a linear model trained with batch gradient descent on mean squared error, using plain Python lists.

    Arrays & Hashinggradient-descentlinear-regressionmsesimulation
  • Heaps, Sorting & SearchMediumAuto-graded
    Cheapest Full Merge and Matching-Sum Product Total

    Combine a Huffman-style min-heap greedy for the cheapest full merge with a frequency-map count of index pairs hitting a target sum, summing their products.

    Heaps, Sorting & Searchheapgreedyhash-mapcounting
  • Data Structure DesignMediumAuto-graded
    Lifespan Lookups for Orders and Order Groups in a Replay Log

    Simulate a class through an operations list, tracking per-order and per-group start and end times so lookups run in constant time, with groups reporting 0 while any member is open.

    Data Structure Designhash-mapdesignsimulationaggregation
  • StringsEasyAuto-graded
    Tab-Scoped Ticket Search with Case-Insensitive Matching

    Filter support tickets by tab, then by a case-insensitive substring match on title or assignee, handling blank queries and unassigned tickets.

    Stringsstringsfilteringcase-insensitivesimulation
  • Arrays & HashingMediumAuto-graded
    Remainder-Sum Windows and Bracket Cleanup

    Count contiguous subarrays whose sum has a given remainder using prefix-sum remainders, and delete the fewest parentheses to balance a string in a fixed, deterministic way.

    Arrays & Hashingprefix-summodular-arithmetichash-countinggreedy
  • Heaps, Sorting & SearchMediumAuto-graded
    One-Car Sweep Scheduler: Order the Elevator Stops

    Order a single elevator's pending floor requests using a one-reversal sweep policy with a priority queue, merging duplicates and respecting the starting direction.

    Heaps, Sorting & Searchheappriority-queuesortingsimulation
  • Trees & GraphsMediumAuto-graded
    Cheapest Letter Rewrites with Directed Price Rules

    Compute the minimum cost to rewrite one string into another with directed priced letter swaps, using shortest paths over 26 letters and handling impossible positions and large totals.

    Trees & Graphsgraphfloyd-warshallshortest-pathstrings
  • Data Structure DesignMediumAuto-graded
    Duplicate Log Suppression Within a Cooldown Window

    Simulate a duplicate-log filter driven by an operation script, tracking per-message cooldowns where only accepted messages restart the timer.

    Data Structure Designhash-mapdesignsimulationrate-limiting