KatInterview

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

Interview Practice Problems

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

5980
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 211–240 of 2215 results

  • Heaps, Sorting & SearchMediumAuto-graded
    Most Frequent Ads Within a Closed Time Range

    Select the K most frequent ad IDs among timestamped impressions in an inclusive window, breaking ties by smaller ID; tests binary search on sorted data plus counting and ordering.

    Heaps, Sorting & Searchbinary-searchhash-mapsortingsliding-window
  • Linked ListsEasyAuto-graded
    Filter Alternate Nodes in a Sequence

    Tests the ability to process a linear collection by dropping elements at even 1-based index positions.

    Linked Listslinked-listsarrayspointers
  • Math & Bit ManipulationEasyAuto-graded
    Compute Multi-User Feature Adoption Metrics

    Given population size and individual adoption probability, calculate key expectation, probability, and conditional probability metrics under Bernoulli assumptions.

    Math & Bit Manipulationmathprobabilitystatisticsnumerical-methods
  • Greedy & IntervalsEasyAuto-graded
    Shift Pay Totals Across Time-of-Day Wage Bands

    Sum payouts for work sessions by intersecting each session with non-overlapping hourly wage bands, using interval overlap arithmetic.

    Greedy & Intervalsintervalsoverlapsimulationarrays
  • Heaps, Sorting & SearchMediumAuto-graded
    Pick the k-th Smallest Value Without Fully Sorting

    Find the k-th smallest value in an unsorted integer list, counting duplicates, using a linear-time selection idea such as quickselect instead of a full sort.

    Heaps, Sorting & Searchquickselectselectionpartitioningorder-statistics
  • Heaps, Sorting & SearchMediumAuto-graded
    Window Mean After Discarding the Top Values

    Compute the mean of every fixed-size window after removing its k largest entries, which requires an ordered structure that supports efficient insertion and deletion.

    Heaps, Sorting & Searchsliding-windowheapfenwick-treeorder-statistics
  • Trees & GraphsMediumAuto-graded
    Negative Loop Reachable From a Source Vertex

    Decide whether a weighted directed graph has a negative-total cycle reachable from a given source vertex, using Bellman-Ford while ignoring unreachable regions.

    Trees & Graphsgraphsbellman-fordnegative-cycleshortest-path
  • Arrays & HashingEasyAuto-graded
    Select Stale Replica Files for Copying

    Filter a list of source file records against destination records using readability, writability, size and timestamp rules, returning names in source order.

    Arrays & Hashinghash-mapfilteringsimulation
  • StringsMediumAuto-graded
    Earliest Second the Secret Is Beyond Repair

    Find the first second at which at least m substrings of a string contain a corrupted character, using complement counting and a reverse-time merge of clean runs.

    Stringsstringsunion-findcountingreverse-simulation
  • Trees & GraphsMediumAuto-graded
    Find a Word Spanning the Fragments at a Tree's Leaves

    Stream the leaf strings of a binary tree in left-to-right order and decide whether a pattern occurs in their concatenation, without ever building the full text.

    Trees & Graphsbinary-treekmpstring-matchingiterative-dfs
  • Arrays & HashingEasyAuto-graded
    Count Distinct Engaged Ads Per Day from an Event Log

    Tests filtering an event log by type, grouping by date, counting distinct ids with sets, and returning date-sorted results while omitting dates that have no qualifying events.

    Arrays & Hashinghash-mapsetgroupingsorting
  • Greedy & IntervalsHardAuto-graded
    Fuse Collinear Point Chains Along Shared Lines

    Group point lists by the infinite line they lie on, then fuse those that overlap or touch along that line, and return each fused group's unique points ordered along the line.

    Greedy & Intervalsgeometryintervalshashingsorting
  • Math & Bit ManipulationHardAuto-graded
    Reachability Under Sum-Replacement Moves on a Grid

    Decide whether one positive integer point can become another by repeatedly replacing a coordinate with the coordinate sum, for values up to 10^18, by reversing moves with modulo.

    Math & Bit Manipulationmatheuclidean-algorithmmoduloreverse-thinking
  • SQL & DataEasyAuto-graded
    Name the Anomaly in an Interleaved Two-Transaction Schedule

    Identify which classic concurrency anomaly a fixed read/read/write/write schedule on one shared value produces, and return the matching option letter.

    SQL & Datatransactionsconcurrencyisolation-levelsserializability
  • Trees & GraphsMediumAuto-graded
    Recover a Letter Ordering from a Sorted Word List

    Derive precedence constraints between letters from adjacent sorted words, then topologically sort them while detecting contradictions and invalid prefix orderings.

    Trees & Graphstopological-sortgraphstringscycle-detection
  • SQL & DataEasyAuto-graded
    Sponsors Active in Both Opening Weeks

    Given a log of ad submission rows, find the sponsors with at least one submission in week 1 and at least one in week 2, returned sorted, which tests set intersection and deduplication.

    SQL & Datasetsdeduplicationintersectiondata-manipulation
  • Trees & GraphsMediumAuto-graded
    Tallest Chain of Nodes in an Index-Linked Binary Tree

    Compute the height of a binary tree given as a child-index table, handling empty input and very deep skewed trees without recursion failures.

    Trees & Graphsbinary-treedfsiterative-traversaltree-height
  • StringsMediumAuto-graded
    Tightest Segment Covering a Required Letter Multiset

    Find the shortest contiguous piece of a text that includes all letters of a target, with repeats and case mattering, using a sliding window with counts and earliest-start tie-breaking.

    Stringssliding-windowtwo-pointershash-mapstrings
  • Data Structure DesignMediumAuto-graded
    Batch Word and In-Order Phrase Lookup Over Text Documents

    Build an inverted index with token positions to answer whole-word and in-order phrase queries over documents, handling repeated words and punctuation.

    Data Structure Designinverted-indexhash-mapbinary-searchtokenization
  • StringsEasyAuto-graded
    Ordered Symbol Tally by First Occurrence

    Count how often each character occurs in a string and report the tallies in the order the characters first appear, treating every character as distinct and significant.

    Stringshash-mapstringcountingordered-dict
  • Heaps, Sorting & SearchMediumAuto-graded
    Batched Binary Search with Query Caching

    Evaluate efficient sorted array lookups for repetitive queries using binary search combined with memoization.

    Heaps, Sorting & Searchbinary-searcharraysmemoizationhashing
  • Dynamic ProgrammingMediumAuto-graded
    Probability of Adjacent Car Groups in a Random Parking Row

    Count placements of k items in n slots with at least m maximal runs of length 2 or more, using a counting DP or combinatorics, and return the exact probability.

    Dynamic Programmingcombinatoricsprobabilitydynamic-programmingcounting
  • Greedy & IntervalsMediumAuto-graded
    Shift Tracker and Earnings Simulator

    Simulate employee shifts, structural updates, bonus intervals, filtering, and time-bounded payroll computations.

    Greedy & Intervalsdesignsimulationintervalssorting
  • SQL & DataEasyAuto-graded
    Users Logging In Successfully From Several Countries

    Group login records by user, keep only exact-match successful ones, and report users whose successful logins span at least two distinct countries, sorted.

    SQL & Datahash-mapsetsfilteringgroup-by
  • StringsEasyAuto-graded
    Elapsed Minutes Since the Latest Bus Pull-Out

    Convert clock strings to minutes and find the shortest wrap-around gap back to a past departure, covering unsorted input, duplicates and an empty schedule.

    Stringstime-parsingmodular-arithmeticwrap-aroundlinear-scan
  • Data Structure DesignMediumAuto-graded
    Rolling-Window Request Throttle Per Client Address

    Simulate a per-IP sliding-window-log throttle over a sequence of requests, using per-key queues with lazy expiry and strict half-open window boundaries.

    Data Structure Designsliding-windowdequehash-maprate-limiter
  • StringsEasyAuto-graded
    Longest Distinct Run and First Singleton Position

    Tests a sliding window with last-seen indices plus a frequency count to find the longest repeat-free substring and the earliest character occurring exactly once.

    Stringssliding-windowhash-mapstringsfrequency-count
  • Data Structure DesignMediumAuto-graded
    Ring Buffer Double-Ended Queue Simulator

    Simulate a bounded double-ended queue over a batch of commands using a circular buffer with constant-time operations and correct index wraparound.

    Data Structure Designdequecircular-buffersimulationdesign
  • Data Structure DesignMediumAuto-graded
    Live Poll Leaderboard: Track the Current Front-Runner

    Process a batch of vote and leader-query operations over named options, using counters and a tie-break rule to report the current leader after each query efficiently.

    Data Structure Designhash-mapheapsimulationtie-breaking
  • Greedy & IntervalsMediumAuto-graded
    Best Result After Removing a Single Five from a Number String

    Remove exactly one '5' from a digit string to get the lexicographically largest result of equal length, using a greedy scan and preserving leading zeros.

    Greedy & Intervalsgreedystringsdigitsexchange-argument