KatInterview

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

Interview Practice Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 91–120 of 2211 results

  • StringsEasyAuto-graded
    Mirror Check Ignoring Punctuation and Letter Case

    Check whether a string is a palindrome when only letters and digits count and case is ignored, using two pointers with constant extra space.

    Stringstwo-pointersstringspalindrome
  • Arrays & HashingEasyAuto-graded
    Ledger Replay Cleanup: Apply Each Payment Event Once

    Process a stream of possibly redelivered payment events and compute final account balances by applying each unique event ID only once.

    Arrays & Hashinghash-sethash-mapdeduplicationsimulation
  • Data Structure DesignMediumAuto-graded
    Ranking Frequent Event Names Within a Time Window

    Simulate a stream of timestamped log events and answer window queries for the k most frequent messages, with ties broken alphabetically, using binary search over a sorted log.

    Data Structure Designdesignbinary-searchhash-mapsorting
  • Heaps, Sorting & SearchMediumAuto-graded
    Greedy Tile Placement Across Parallel Lanes

    Simulate placing items one by one into the currently lowest lane, breaking ties by lowest index, and report each lane's final total using a min-heap.

    Heaps, Sorting & Searchheapgreedysimulationpriority-queue
  • Trees & GraphsMediumAuto-graded
    Minimum Rides Across Circular Shuttle Lines

    Find the fewest shuttle lines to board to get from one stop to another, using a graph search over lines and a stop-to-lines index to stay linear in total stops.

    Trees & Graphsbfsgraphhash-mapshortest-path
  • Greedy & IntervalsMediumAuto-graded
    Canonical Path Cleanup Plus Overlapping Range Union

    Combine stack-based Unix path normalization with sort-and-sweep merging of overlapping or touching closed ranges, returning both results in one list.

    Greedy & Intervalsstacksortingintervalsstrings
  • Arrays & HashingMediumAuto-graded
    Shortest Total Flight on a Circular Track of Stations

    Sum the shortest arc distances between consecutive stops on a ring with weighted edges, using prefix sums for O(1) arc queries.

    Arrays & Hashingprefix-sumcircular-arraysimulation
  • Trees & GraphsMediumAuto-graded
    Edge Silhouettes of a Level-Order Binary Tree

    Build a binary tree from a level-order list with gaps and report the first and last node of every level, testing BFS level separation and level-order parsing.

    Trees & Graphsbinary-treebfslevel-ordertree-construction
  • Arrays & HashingHardAuto-graded
    Identify Most Popular Three-Page User Sequence

    Process website activity logs to compute chronological 3-site visit subsequences and find the most widely performed pattern across unique users.

    Arrays & Hashingarrayshash-tablesortingsubsequence
  • Data Structure DesignMediumAuto-graded
    Article Reaction Ledger with Recent Reversal Log

    Simulate a stream of up/down/clear reactions on articles, maintaining net scores and a bounded log of the three most recent reversals per article, all in constant time per operation.

    Data Structure Designhash-mapdequesimulationstate-tracking
  • Arrays & HashingEasyAuto-graded
    Rank Companion Items by Shared Collections

    Count how often each item shares a collection with a target item, then rank by count descending and name ascending, with an optional cap on the result length.

    Arrays & Hashinghash-mapcountingsortingco-occurrence
  • Math & Bit ManipulationMediumAuto-graded
    Expected Matching-Rank Pairs in a Random Card Hand

    Compute the expected number of same-rank card pairs in a hand drawn without replacement, using linearity of expectation over pairs of cards.

    Math & Bit Manipulationprobabilityexpectationcombinatoricslinearity-of-expectation
  • StringsMediumAuto-graded
    Minimal Distinguishing Abbreviations for a Word List

    Compute, for each word, the shortest leading substring shared with no other entry, using prefix counting or a trie, and return the whole word when none exists.

    Stringstrieprefixhash-mapstrings
  • Trees & GraphsMediumAuto-graded
    Fewest Rolls to Park a Sliding Ball in a Grid

    Model a sliding ball as BFS over resting positions, where each edge is a full roll until a wall or border, and the target counts only if the ball stops on it.

    Trees & Graphsbfsgridgraphshortest-path
  • Data Structure DesignEasyAuto-graded
    Running Tally per Label from a Replayed Call Log

    Replay a log of increment calls and report, for each call, how many times its key has appeared so far, testing hash map counting and a simple operation-dispatch design.

    Data Structure Designhash-mapsimulationdesigncounting
  • Data Structure DesignMediumAuto-graded
    Fixed-Size Ring Buffer Command Simulator

    Simulate a bounded FIFO ring buffer driven by a list of commands, handling wrap-around, full and empty states, and returning each command's result in order.

    Data Structure Designdesignqueuering-buffersimulation
  • Greedy & IntervalsHardAuto-graded
    Shared High-Activity Windows Across Sensor Feeds

    Merge step-function sensor feeds with a sweep over status-change events to find every maximal inclusive window in which all feeds are at or above a level.

    Greedy & Intervalssweep-lineintervalsstep-functionbinary-search
  • Math & Bit ManipulationEasyAuto-graded
    Binomial and Poisson Rare Event Tail Probabilities

    Computes the exact binomial tail probability P(X > k) and its Poisson approximation parameterised by lambda = n * p.

    Math & Bit Manipulationmathstatisticsprobability
  • Arrays & HashingMediumAuto-graded
    Three-Bucket Rearrangement With Constant Extra Space

    Tests in-place three-way partitioning of an array holding only 0, 1 and 2 using constant extra space and a single linear pass, with careful pointer invariants.

    Arrays & Hashingtwo-pointersin-placepartitioningsorting
  • Data Structure DesignMediumAuto-graded
    Expense Reimbursement Ledger Simulator

    Simulate an expense tracking ledger executing sequential API calls with validation and error checks.

    Data Structure Designdesign-dsarrayshash-table
  • Trees & GraphsEasyAuto-graded
    Verify Root Sequence Match in N-ary Tree

    Determine if a given target sequence matches a top-down path in an N-ary tree represented by nested dictionaries.

    Trees & Graphstrees-graphsrecursiondfstree-traversal
  • Greedy & IntervalsMediumAuto-graded
    Collapse Booked Time Ranges Into Disjoint Blocks

    Combine closed integer ranges that overlap or share an endpoint into disjoint blocks, tests sorting plus a single sweep and careful boundary handling.

    Greedy & Intervalsintervalssortinggreedysweep
  • Data Structure DesignMediumAuto-graded
    Nested Undo-Log Session Store with Value Tallies

    Simulate an in-memory key-value store with nested transactions, a global commit, and a live per-value key tally, processing a batch of operations and returning each result.

    Data Structure Designhash-mapundo-logtransactionssimulation
  • Trees & GraphsMediumAuto-graded
    Counting Separate Land Patches in a 0/1 Grid

    Count connected components of 1-cells in a binary grid using only up/down/left/right adjacency, via flood fill or union-find.

    Trees & Graphsgraphbfsconnected-componentsmatrix
  • Arrays & HashingMediumAuto-graded
    Repeat Visitors Across UTC Days in an Event Feed

    Normalize ISO 8601 timestamps to UTC dates and use hashing to find users active on at least two distinct UTC calendar days.

    Arrays & Hashinghashingdatetimetimezonelogs
  • Math & Bit ManipulationMediumAuto-graded
    Cover an IPv4 Address Run with the Fewest Prefix Blocks

    Split a run of consecutive IPv4 addresses into the fewest aligned power-of-two prefix blocks using 32-bit integer and lowest-set-bit reasoning.

    Math & Bit Manipulationbit-manipulationgreedyipv4cidr
  • Arrays & HashingMediumAuto-graded
    Longest Daily Purchase Streak for Each Customer

    Group purchase records by customer, collapse same-day duplicates, and find the longest run of back-to-back calendar days, reporting results sorted by customer id.

    Arrays & Hashinghashingsortingdatesgaps-and-islands
  • Trees & GraphsMediumAuto-graded
    Smallest-Label Build Sequence with Cycle Check

    Produce the lexicographically smallest valid ordering of a dependency graph using a min-heap variant of Kahn's algorithm, returning an empty list if a cycle makes ordering impossible.

    Trees & Graphstopological-sortheapgraphcycle-detection
  • Greedy & IntervalsMediumAuto-graded
    Smallest-ID Room Allocation for Booking Time Slots

    Partition half-open time intervals across the fewest resources, deterministically giving each booking the lowest-numbered free resource, using sorting and two heaps.

    Greedy & Intervalsintervalsheapgreedysorting
  • Data Structure DesignMediumAuto-graded
    Simulate an Expiring Key-Value Store with Read-Through Loads

    Simulate a time-aware key-value store with expiry, stale entries that stay stored, and a read-through fetch whose loader outcome is given as data, with strict input validation.

    Data Structure Designsimulationhash-mapcachevalidation