KatInterview

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

Coding Interview Problems

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

6046
Problems
2239
Auto-graded
15
Topics
273
Added today

Showing 1471–1500 of 2792 results

  • 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
  • Data Structure DesignMediumModel answer
    Timeline Lookup Store and Shared-Friend Suggestions

    Build a store that returns the latest value at or before a query time, then suggest new connections to a user based on having at least two friends in common.

    Data Structure Designbinary-searchhash-mapgraphdesign
  • 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 ManipulationMediumModel answer
    Back-Calculating a Kayak Trip's Start Time from River Speeds

    Two paddlers' first-day upstream and downstream legs fix their paddling speed. Use it to find when they must leave on day two to reach a point 23 miles upstream by 16:00.

    Math & Bit Manipulationword-problemrelative-velocityrate-time-distancealgebra
  • StringsMediumModel answer
    Three Compiler Defects in a Mini Template Engine: Debug and Test

    Diagnose three failures in a small Python template-to-source compiler: a lost ternary branch, a directory returned as a template, and a comment-only loop body, then fix each and add a regression test.

    Stringsdebuggingcode-generationastregression-testing
  • 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
  • Heaps, Sorting & SearchMediumModel answer
    Batched Notification Sender with Cooldown-Aware Retries

    Push messages through a provider that accepts at most 5 per call, and retry each failure only after its own cooldown expires, with an attempt cap and no busy-waiting.

    Heaps, Sorting & Searchbatchingpriority-queueretry-schedulingmin-heap
  • 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 DesignMediumModel answer
    Audit a Flawed Proximity-Search Module in Python

    Review a small Python module for finding and labeling nearby places, spotting correctness, speed and design problems, then propose and justify concrete refactors.

    Data Structure Designcode-reviewpythongeospatialhaversine
  • Trees & GraphsMediumModel answer
    Concurrent Site Crawler with Fault-Tolerant Fetching

    Build a crawler that explores every page reachable from a seed URL using a slow, flaky link API, evolving from a sequential traversal to a thread pool with bounded, backoff-driven retries.

    Trees & Graphsweb-crawlerconcurrencybfsretries
  • 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
  • Heaps, Sorting & SearchMediumModel answer
    Cost of Core Data Structure Ops and When Threads Hurt

    Give worst-case Big-O for four common array, hash table and heap operations, then explain why adding threads does not always speed a program up, with concrete counterexamples.

    Heaps, Sorting & Searchbig-ohash-tableheapmultithreading
  • 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
  • Heaps, Sorting & SearchMediumModel answer
    Fixed-Width Window Totals and Rolling Median Over a Stream

    Find the best sum over any run of k adjacent numbers, then track the median of the latest k values in a live stream, discussing data structures, parallelism and trade-offs.

    Heaps, Sorting & Searchsliding-windowtwo-heapsmedianlazy-deletion
  • 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
  • Data Structure DesignMediumModel answer
    Weighted Random Picker for Unbounded Integer Scores

    Build a picker that returns an item with probability proportional to its weight, even when weights and their total exceed 32-bit or 64-bit limits, and discuss precision and memory trade-offs.

    Data Structure Designrandomized-algorithmsprefix-sumbinary-searchalias-method
  • Data Structure DesignMediumModel answer
    Design a Pluggable Payroll Cost Estimator

    Design the types and API that compute an employee's full cost from salary, tax, benefits, and a signed location adjustment, with exact money math, explicit missing-rule handling, and versioned rules.

    Data Structure Designobject-modelingapi-designmoney-handlingconfiguration-versioning
  • 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
  • Data Structure DesignHardModel answer
    Steady-Cadence Frame Player with Bounded Decode Buffer

    Build a thread-safe player where a decoder thread fills a bounded buffer and a render thread emits frames at a fixed rate on a monotonic clock, with clean pause, stop and underrun handling.

    Data Structure Designconcurrencyproducer-consumerthreadingscheduling
  • 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