KatInterview

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

Interview Practice Problems

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

6003
Problems
2223
Auto-graded
15
Topics
273
Added today

Showing 601–630 of 2223 results

  • Dynamic ProgrammingHardAuto-graded
    Balanced Parentheses After Digit-Driven Removals

    Decide whether removing parentheses to satisfy per-digit quotas can leave a balanced bracket string, using a DP over balance and removal count.

    Dynamic Programmingdynamic-programmingstringsparenthesesstate-compression
  • Trees & GraphsEasyAuto-graded
    Prune a Labeled Tree by Forbidden Substring

    Recursively copy an n-ary tree while dropping every node whose label contains a given substring, together with its subtree, without mutating the input.

    Trees & Graphstreerecursiondfsstrings
  • Trees & GraphsMediumAuto-graded
    Players Whose Leaderboard Position Is Forced

    Find every player comparable to all others in a consistent win/loss DAG, using transitive reachability in both directions, ideally with bitsets.

    Trees & Graphsgraphtopological-sorttransitive-closurebitset
  • Math & Bit ManipulationEasyAuto-graded
    Product of Three Dice: Summary Statistics Report

    Enumerate all 216 outcomes of three dice to compute the mean, modes, prime probability and median of their product, and return a fixed risk note.

    Math & Bit Manipulationenumerationprobabilitycountingstatistics
  • Arrays & HashingEasyAuto-graded
    Find Lowest Cost Ticket Pair Across Consecutive Days

    Find the minimum combined cost of an outbound and return ticket where return happens strictly after departure.

    Arrays & Hashingarraysgreedyprefix-minimum
  • Arrays & HashingMediumAuto-graded
    Users Active for a Week Straight: Detect 7-Day Streaks in Event Logs

    Find users whose event log contains at least seven consecutive UTC calendar days of activity, using per-user day deduplication and a sorted streak scan.

    Arrays & Hashinghashingdatesstreakssorting
  • Dynamic ProgrammingEasyAuto-graded
    Bankrupt Risk in Dice Game

    Compute the exact probability of wealth hitting zero or below at any step during a finite sequence of random dice rolls.

    Dynamic Programmingdynamic-programmingmath-bitsstatistics
  • Arrays & HashingEasyAuto-graded
    Calculate Maximum Single-Trade Return

    Find the maximum non-negative profit from purchasing an asset on one day and selling it on a subsequent day.

    Arrays & Hashingarraysdynamic-programminggreedy-intervals
  • Math & Bit ManipulationEasyAuto-graded
    Middle Age Band Share Among Cycling Respondents

    Restrict a 3x3 survey table to one column and return an exact reduced fraction for a conditional probability.

    Math & Bit Manipulationprobabilityfractionstablesgcd
  • Data Structure DesignMediumAuto-graded
    Failure Streaks and Fix Times from a Live Test Log

    Process a stream of pass/fail log operations, answering shortest-fix-time and longest-concurrent-failure-window queries with an incremental, level-based data structure.

    Data Structure Designdesignstreamingintervalshash-map
  • Heaps, Sorting & SearchMediumAuto-graded
    K-th Smallest Entry in a Row and Column Sorted Grid

    Find the k-th smallest value in a two-dimensional grid where every row and column is sorted in ascending order.

    Heaps, Sorting & Searchbinary-searchmatrixheaps-sorting
  • Greedy & IntervalsMediumAuto-graded
    Largest Number With Even Counts of Both Digits

    Delete characters from a string of 1s and 2s so both digit counts are even and the number is largest, testing greedy deletion with parity reasoning.

    Greedy & Intervalsgreedystringstacksubsequence
  • Data Structure DesignMediumAuto-graded
    Replay Operations on a Fixed-Size Ring Buffer Queue

    Simulate a fixed-capacity circular FIFO queue from an operation log, handling wraparound, full and empty states, and logical index lookups in constant time per operation.

    Data Structure Designcircular-queuering-buffersimulationdesign
  • Arrays & HashingEasyAuto-graded
    Cross-Tabulate Records by Composite Row and Column Keys

    Group records by composite row and column keys, sum a value field per pair, and return the axes in first-seen order with a dense grid that has zeros for missing pairs.

    Arrays & Hashinghash-mapgroupingaggregationtuples
  • Data Structure DesignHardAuto-graded
    Simulate LFU Cache Sequence

    Process a series of LFU cache queries with LRU tie-breaking and track the output of each operation.

    Data Structure Designhash-tablelinked-listdesignlfu-cache
  • Arrays & HashingMediumAuto-graded
    Gravity Grid: Pushing Tokens Up from Below and Spotting Matching Lines

    Simulate a grid where tokens are pushed in from the bottom of a column, and after each push report success and whether any full column or full row is single-typed.

    Arrays & Hashingsimulationmatrixstate-trackinggrid
  • Dynamic ProgrammingMediumAuto-graded
    Cheapest Daily Ticket Plan Without Back-to-Back Repeats

    Choose one of three item types each day with no type repeated on adjacent days, minimizing total cost and returning the unique optimal sequence of choices.

    Dynamic Programmingdynamic-programmingpath-reconstructionpaint-house
  • Math & Bit ManipulationMediumAuto-graded
    Overflow-Safe Probability Normalization of Raw Scores

    Convert a list of real scores into a probability distribution via exponentiation and normalization, without overflow or division-by-zero for extreme input values.

    Math & Bit Manipulationnumerical-stabilitymathfloating-pointarrays
  • Trees & GraphsMediumAuto-graded
    Smallest Valid Task Schedule with Prerequisites

    Produce the lexicographically smallest topological ordering of a directed graph, or report that no ordering exists because of a cycle.

    Trees & Graphstopological-sortheapgraphcycle-detection
  • Math & Bit ManipulationEasyAuto-graded
    Recover Total Weight From All Pairwise Crate Readings

    Tests the double-counting insight that each item appears in a fixed number of pair sums, so the total equals the sum of the readings divided by a constant.

    Math & Bit Manipulationmathcountingpairwise-sumsarithmetic
  • Math & Bit ManipulationEasyAuto-graded
    Chance a Pair Tops Another Pair in Four Random Ratings

    Compute the probability that two items from one group both beat two items from another group when all four scores are i.i.d. and continuous, using a symmetry and ranking-count argument.

    Math & Bit Manipulationprobabilitycombinatoricssymmetrybrainteaser
  • Trees & GraphsMediumAuto-graded
    Tree Height and Peak Concurrent Bookings

    Compute the height of an index-encoded binary tree without deep recursion, and the minimum rooms needed for half-open time intervals, returned together as a pair.

    Trees & Graphsbinary-treeiterative-dfsintervalssweep-line
  • Math & Bit ManipulationEasyAuto-graded
    Tally Repeat-Free Three-Digit Numbers Up To a Limit

    Count integers from 100 up to a given limit whose three digits are all different, using direct enumeration or combinatorial reasoning.

    Math & Bit Manipulationmathenumerationdigitscounting
  • StringsHardAuto-graded
    Build a Recursive-Descent Decoder for a JSON Subset

    Write a strict recursive-descent parser that turns JSON text into Python values and raises ValueError on any malformed input.

    Stringsparsingrecursive-descentstringsrecursion
  • Math & Bit ManipulationMediumAuto-graded
    Earliest Disc Overlap Among Unicycle-Driven Agents

    Simulate several disc-shaped agents with forward Euler unicycle motion and report the first time step at which any pair overlaps, with all pairs at that step.

    Math & Bit Manipulationsimulationgeometryfloating-pointpairs
  • Heaps, Sorting & SearchMediumAuto-graded
    Longest Uniform Cut Length from Rope Pieces

    Find the largest integer length such that cutting every rope into pieces of that length yields at least k pieces; tests binary search over a monotonic answer space.

    Heaps, Sorting & Searchbinary-searchbinary-search-on-answermonotonic-predicatearrays
  • Trees & GraphsEasyAuto-graded
    Find Tree K-th Ancestor for Queries

    Answer k-th ancestor queries on a rooted tree efficiently using binary lifting.

    Trees & Graphstrees-graphsmath-bitsarrays
  • Data Structure DesignMediumAuto-graded
    Replay-Safe Versioned Record Updates Simulator

    Simulate a record store that applies updates with optimistic version checks and per-record idempotency keys, replaying cached results for retries and rejecting reused keys.

    Data Structure Designdesignhash-mapidempotencyoptimistic-concurrency
  • Arrays & HashingEasyAuto-graded
    Check Loan Records for Proper Borrow-Return Order

    Scan a time-ordered list of library events and verify each item's history strictly alternates borrow, return, starting with a borrow, using per-item state tracking.

    Arrays & Hashinghash-setstate-trackingsimulationvalidation
  • Stacks & QueuesEasyAuto-graded
    Well-Formed Bracket Sequence Checker

    Decide whether a string of three kinds of brackets is correctly nested, using a stack to enforce that the most recently opened bracket is closed first.

    Stacks & Queuesstackstringmatchingparsing