KatInterview

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

Coding Interview Problems

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

5985
Problems
2218
Auto-graded
15
Topics
271
Added today

Showing 271–300 of 2769 results

  • 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
  • Trees & GraphsMediumModel answer
    Mapping a Hidden Maze: Shortest Route for a Sensing Robot

    A robot in an unseen grid senses neighbours for free and pays per move. Find a shortest route to a target, or return to the start and report failure if none exists.

    Trees & Graphsbfsgridonline-explorationshortest-path
  • 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
  • Trees & GraphsMediumModel answer
    Right Edge of a Tree and Minimal Bracket Removal

    Two linked tasks: list the nodes visible from the right of a binary tree, and delete the fewest parentheses from a string so the rest is balanced.

    Trees & Graphsbinary-treebfsstackstrings
  • 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
  • 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 DesignMediumModel answer
    What Java's volatile Does and Does Not Guarantee

    Explain the Java Memory Model guarantees of volatile fields: visibility, happens-before ordering and reordering limits, its gaps such as compound atomicity, and when to prefer locks or atomics.

    Data Structure Designjavaconcurrencymemory-modelvolatile
  • 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