KatInterview

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

Interview Practice Problems

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

5981
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 241–270 of 2215 results

  • Trees & GraphsMediumAuto-graded
    Counting Land Clusters on a Wrap-Around Map

    Count connected groups of land cells on a grid whose opposite edges wrap around, testing grid traversal with modular adjacency.

    Trees & Graphsgraphdfsgridunion-find
  • Arrays & HashingMediumAuto-graded
    Sliding Token on a Grid with Timed Heading Changes

    Compute a token's final cell on a grid with blocked cells when its heading changes at given timestamps up to 10^9, which requires processing time segments instead of simulating each tick.

    Arrays & Hashingsimulationgridintervalslarge-input
  • Math & Bit ManipulationMediumAuto-graded
    Group Size Threshold and Closest-Pair Gap on a Circle

    Compute a birthday-collision threshold exactly and by approximation, plus expected minimum gap and tail probability for random points on a circle, with a Poisson comparison.

    Math & Bit Manipulationprobabilitymathbirthday-paradoxpoisson-approximation
  • Arrays & HashingMediumAuto-graded
    Sliding Window Maxima on a Grid With Source Positions

    Slide a square window over an integer grid with a given step, and report each window's maximum with its grid coordinates, resolving ties by the smallest row, then the smallest column.

    Arrays & Hashingmatrixsliding-windowsimulationtie-breaking
  • Math & Bit ManipulationMediumAuto-graded
    Exponentiation by Squaring with Negative Exponents

    Compute a floating-point base raised to a signed 32-bit integer exponent in logarithmic time, including negative exponents, using repeated squaring.

    Math & Bit Manipulationbinary-exponentiationmathbit-manipulationfloating-point
  • Greedy & IntervalsEasyAuto-graded
    Conflict-Free Schedule Check for a Single Attendee

    Tests sorting intervals and scanning adjacent pairs to detect overlaps under half-open interval rules, where touching endpoints are allowed.

    Greedy & Intervalsintervalssortinggreedyarrays
  • Arrays & HashingEasyAuto-graded
    Coupon Usage Caps: Check Remaining Redemptions per User

    Count past coupon redemptions per (user, coupon) pair from a log, then answer many read-only queries on whether each user is still under the coupon's cap.

    Arrays & Hashinghash-mapcountingaggregationcomposite-key
  • Math & Bit ManipulationEasyAuto-graded
    Card Launch Unit Economics Report Builder

    Build a fixed unit-economics report for a card launch: portfolio P&L, partnership uplift, bonus payback time, and the zero-profit loss rate.

    Math & Bit Manipulationmathsimulationunit-economicsdictionaries
  • Trees & GraphsMediumAuto-graded
    Unlock Order: Build a Dependency-Respecting Study Plan

    Produce a deterministic topological ordering of nodes from prerequisite pairs, or an empty list if a cycle makes it impossible. Tests graph modeling and Kahn's algorithm.

    Trees & Graphstopological-sortgraphbfscycle-detection
  • Data Structure DesignHardAuto-graded
    Fault-Tolerant Task Dispatcher with Retry Limit and Dependencies

    Simulate a job queue where failed jobs retry up to a limit, then go to a dead-letter list, and failures cascade to jobs that depend on them.

    Data Structure Designsimulationqueuegraphstate-machine
  • Arrays & HashingMediumAuto-graded
    Earliest-Completing Pair That Hits a Target Sum

    Find the pair of indices whose values sum to a target, choosing the pair that finishes earliest in the array, with deterministic duplicate handling, using a one-pass hash map.

    Arrays & Hashinghash-maptwo-sumduplicatesone-pass
  • StringsMediumAuto-graded
    Filter Words Expandable to Target String

    Determine which words from a dictionary can yield a target string by expanding consecutive duplicate characters in place.

    Stringsstringstwo-pointersarrays
  • Arrays & HashingEasyAuto-graded
    Mean Household Earnings with Gaps in the Data

    Compute the mean of a list of numbers while skipping None and NaN entries, returning 0.0 when nothing valid remains and rounding to two decimals.

    Arrays & Hashingarraysdata-cleaningnan-handlingaggregation
  • SQL & DataMediumAuto-graded
    Best-Scoring Enrollee for Each Academic Department

    Pick one top student per department from two record lists, using GPA with deterministic tie-breaks, skipping missing values, and keeping departments that have no eligible student.

    SQL & Datagroup-wise selectionleft jointie-breakingnull handling
  • StringsMediumAuto-graded
    Bracket the Shortest Exclusive Fragment in Every Menu Entry

    Find, for each string, its shortest substring that occurs in no other string (case-insensitive), with leftmost tie-break, and wrap it in brackets while keeping original casing.

    Stringsstringshash-mapsubstringsbitmask
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Bag Selection Probability via Bayes' Theorem

    Given selection priors and ball counts for several containers, calculate the posterior probability of drawing from a specific container after observing a target outcome.

    Math & Bit Manipulationmathprobabilitybayes-theoremarrays
  • Trees & GraphsMediumAuto-graded
    Gather Unique Items Across a Linked Collection Graph

    Run a breadth-first traversal over a directed graph of folders, emitting each item once in first-seen order, while validating every reference and handling cycles.

    Trees & Graphsbfsgraphhash-setdeduplication
  • Arrays & HashingMediumAuto-graded
    Bucket Words That Share the Same Letters

    Partition a list of lowercase words into buckets of mutual rearrangements, using a canonical key and a hash map while keeping a deterministic output order.

    Arrays & Hashinghash-mapstringssortinggrouping
  • Trees & GraphsMediumAuto-graded
    Level-by-Level Site Walk With Failing Pages and a Fetch Cap

    Compute a deterministic level-ordered listing of every page reachable from a start page, where failed pages yield no links and concurrency limits must not change the result.

    Trees & Graphsbfsgraphlevel-ordersets
  • Data Structure DesignEasyAuto-graded
    Simulate a Task Management Engine with CRUD Operations

    Simulate an in-memory task tracker handling creation, retrieval, updates, filtering, and deletion of tasks with valid state validation.

    Data Structure Designdesign-dsarraysdata-structuressimulation
  • SQL & DataMediumAuto-graded
    Monthly Line Output Report with Running Totals and Defect Percent

    Group daily production records by line and month, add a per-line running total, and compute each month's defect percentage from summed counts.

    SQL & Datagroup-byhashingrunning-totalaggregation
  • Arrays & HashingMediumAuto-graded
    Event Log Selector with Window, Dedupe and Cap

    Filter a list of event records by type, time window and id, then order them stably by timestamp and truncate, testing careful handling of optional arguments and ties.

    Arrays & Hashinghashingstable-sortfilteringdedupe
  • Trees & GraphsMediumAuto-graded
    Fewest Hops from a Start Node While Avoiding Closed Nodes

    Run a breadth-first search on a directed or undirected graph, skipping closed nodes, to get each node's minimum edge count from the start, or -1 if it cannot be reached.

    Trees & Graphsbfsgraphshortest-pathreachability
  • Trees & GraphsMediumAuto-graded
    Identify Cycles in Linear Chains and Directed Networks

    Detect structural loops in both a next-pointer chain using constant space and a directed graph reachable from a given entry point.

    Trees & Graphstrees-graphslinked-listsdfstwo-pointers
  • Arrays & HashingMediumAuto-graded
    Circular Lamps with Traveling Togglers

    Find the final bits on a ring after several togglers walk clockwise for k steps, using lap decomposition, parity, and a cyclic difference array.

    Arrays & Hashingdifference-arraymodular-arithmeticparitysimulation-optimization
  • Math & Bit ManipulationEasyAuto-graded
    Head Counts in n Fair Coin Tosses: Sequences and Tail Odds

    Compute the number of sequences, the chance of exactly 3 heads, and the chance of at most 3 heads for n fair coin tosses, using binomial counting and handling small n.

    Math & Bit Manipulationcombinatoricsbinomialprobabilitymath
  • Arrays & HashingMediumAuto-graded
    Triple Challenge: Price Drops, Bounded Windows, Twin Rows

    Combine a threshold binary search with greedy arithmetic sums, a linear scan counting subarrays with exact min and max, and hashing of binary rows to count identical pairs.

    Arrays & Hashingbinary-searchgreedysliding-windowhashing
  • Heaps, Sorting & SearchMediumAuto-graded
    Read a Value Off a Connected Line-Segment Graph

    Evaluate a piecewise linear curve at a query coordinate by locating the right segment with binary search and interpolating, returning None outside the curve's domain.

    Heaps, Sorting & Searchbinary-searchinterpolationarraysedge-cases
  • Data Structure DesignMediumAuto-graded
    Conditional Form Visibility with Numeric Checks and Nested Groups

    Decide which questions of a form are visible by parsing typed answers and evaluating validated, nestable all/any conditions with numeric comparisons.

    Data Structure Designparsingvalidationrecursiondecimal
  • Math & Bit ManipulationMediumAuto-graded
    Collapse a Sequence to Ones Using Neighbor GCD Replacements

    Find the minimum number of neighbor-GCD replacements to turn an entire array into ones, using shortest coprime-window search and a lower-bound argument.

    Math & Bit Manipulationgcdsubarraynumber-theorycase-analysis