KatInterview

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

Coding Interview 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 211–240 of 2115 results

  • 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
  • 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
  • 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
  • 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
  • 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