KatInterview

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

Interview Practice 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 2218 results

  • Heaps, Sorting & SearchMediumAuto-graded
    Read a Value Off a Connected Line-Segment Graph

    Evaluate a piecewise linear curve at a query coordinate by locating the right segment with binary search and interpolating, returning None outside the curve's domain.

    Heaps, Sorting & Searchbinary-searchinterpolationarraysedge-cases
  • Data Structure DesignMediumAuto-graded
    Conditional Form Visibility with Numeric Checks and Nested Groups

    Decide which questions of a form are visible by parsing typed answers and evaluating validated, nestable all/any conditions with numeric comparisons.

    Data Structure Designparsingvalidationrecursiondecimal
  • Math & Bit ManipulationMediumAuto-graded
    Collapse a Sequence to Ones Using Neighbor GCD Replacements

    Find the minimum number of neighbor-GCD replacements to turn an entire array into ones, using shortest coprime-window search and a lower-bound argument.

    Math & Bit Manipulationgcdsubarraynumber-theorycase-analysis
  • StringsMediumAuto-graded
    Earliest Longest Mirror Segment in a String

    Find the longest contiguous segment of a string that reads identically in both directions, preferring the leftmost one on ties and returning an empty string for empty input.

    Stringsstringspalindromeexpand-around-centertwo-pointers
  • Trees & GraphsMediumAuto-graded
    Minesweeper Tap: Flood-Reveal Safe Cells and Show Mine Counts

    Simulate one Minesweeper tap on a grid, flood-revealing connected zero-count cells with an iterative traversal and labelling border cells with their 8-neighbour mine counts.

    Trees & Graphsbfsflood-fillgridmatrix
  • Stacks & QueuesMediumAuto-graded
    Expand a Compressed Bracket Pattern String

    Tests stack-based parsing of nested repeat-count patterns, including multi-digit counts, nesting, and trailing letters, to rebuild the fully expanded string.

    Stacks & Queuesstackstringparsingnested-structures
  • Heaps, Sorting & SearchMediumAuto-graded
    Rotated Array Lookup Plus Most Common Values

    Find a value's index in a rotated sorted array with binary search, then list the k most frequent values with ties broken by smaller value.

    Heaps, Sorting & Searchbinary-searchrotated-arrayhash-mapfrequency-count
  • Dynamic ProgrammingMediumAuto-graded
    Shortest Nested Run-Length Encoding of a String

    Find the shortest nested repeat encoding of a string with interval DP over splits and repeats, using a fixed tie-break order so the output is unique.

    Dynamic Programmingdynamic-programmingstringsrecursionmemoization
  • Data Structure DesignMediumAuto-graded
    Phrase Completion Engine with Windowed Context Counts

    Simulate a command sequence on a context-based next-word model, using hash maps of counts and a lexicographic tie-break.

    Data Structure Designhash-mapn-gramsimulationstring-processing
  • Arrays & HashingMediumAuto-graded
    Contiguous Smallest-Value Blocks in a Shuffled Sequence

    Given a permutation of 1..N, decide for each k whether the values 1..k occupy a contiguous block of positions, using a running min/max position sweep.

    Arrays & Hashingpermutationarrayssweepmin-max
  • Math & Bit ManipulationMediumAuto-graded
    Binary Message Framing Processor

    Simulate encoding and decoding of a length-prefixed binary wire protocol with error validation.

    Math & Bit Manipulationbinaryparsingencodingbit-manipulation
  • StringsMediumAuto-graded
    Longest Run With No Repeated Character

    Find the length of the longest contiguous block of a string with no repeated character, using a linear-time sliding window with exact, case-sensitive comparison.

    Stringssliding-windowhash-maptwo-pointersstrings
  • Stacks & QueuesMediumAuto-graded
    Expand a Compact Pattern with Nested Multipliers

    Expand a string in which a positive integer followed by a bracketed block means that block repeats, with nesting; tests stack or recursive parsing and multi-digit number handling.

    Stacks & Queuesstackstring-parsingnested-structuresrecursion
  • Dynamic ProgrammingMediumAuto-graded
    Best Haul from a Row of Cash Stations

    Tests one-dimensional dynamic programming: pick values from a sequence so no two neighbors are both chosen, maximizing the total.

    Dynamic Programmingdynamic-programmingarraysoptimization
  • Trees & GraphsMediumAuto-graded
    Densest Graph Without Triangles: Count and Build

    Find the largest edge count of a triangle-free simple graph on n vertices and output a canonical extremal graph, testing Mantel's theorem and the complete bipartite construction.

    Trees & Graphsgraph-theoryconstructionbipartitemantel-theorem
  • StringsEasyAuto-graded
    Count Balanced Two-Block Binary Substrings

    Count substrings of a binary string made of one block of equal characters followed by a block of the other character, with both blocks the same length.

    Stringsstringstwo-pointersrun-lengthcounting
  • StringsMediumAuto-graded
    Longest Run Using No More Than Two Letter Kinds

    Find the longest contiguous stretch of a string containing at most two different characters, testing the sliding window technique with a frequency map.

    Stringssliding-windowhash-maptwo-pointersstrings
  • Stacks & QueuesMediumAuto-graded
    Unwrap Deeply Nested Lists Into One Sequence

    Collect every integer from a structure of arbitrarily deep nested lists in left-to-right order, without recursion, so extremely deep inputs do not overflow the call stack.

    Stacks & Queuesstackdfsiteratorsnested-lists
  • Trees & GraphsMediumAuto-graded
    Diff Two Versions of a Keyed Hierarchy

    Compare two keyed N-ary trees given as nested dicts and count nodes that were added, removed, given a new value, or attached to a different parent.

    Trees & Graphstreehash-mapdfstree-diff
  • Data Structure DesignMediumAuto-graded
    Top-of-Book Quotes per Venue and Across All Venues

    Aggregate order records by price level to answer per-venue and market-wide best bid and ask queries, summing the size at the best price.

    Data Structure Designhash-mapaggregationorder-booksimulation
  • Arrays & HashingMediumAuto-graded
    Enumerate All Index Pairs Adding Up to a Goal Value

    Tests hash-map indexing of duplicate values to list every index pair i < j whose values sum to a goal, in a specific sorted output order.

    Arrays & Hashinghash-maptwo-sumduplicatesenumeration
  • Arrays & HashingMediumAuto-graded
    Seven-Day Spend Grid per Shopper Using Only String Dates

    Aggregate (shopper, date, amount) records into per-shopper totals for a 7-day window, using hand-written ISO date stepping and hashing instead of date libraries.

    Arrays & Hashinghashingaggregationstring-datessimulation
  • SQL & DataEasyAuto-graded
    Unify Two Yearly Sales Record Lists With a Mismatched Key

    Tests normalizing records from two sources with a misspelled field name, casting a numeric field to float, and concatenating the lists in order without mutating inputs.

    SQL & Datadata-cleaningdictionariesschema-alignmentconcatenation
  • SQL & DataMediumAuto-graded
    Find Riders Idle Through the Latest Week of Activity

    Given user and ride records, return users with no ride in the 7-day window ending at the latest ride date, including users who never rode, sorted by user_id.

    SQL & Dataanti-joindate-windowhash-setfiltering
  • Greedy & IntervalsMediumAuto-graded
    Peak Overlap of Half-Open Time Ranges

    Compute the largest number of simultaneously running half-open time ranges using a sweep over sorted start and end events, with correct handling of ties at boundaries.

    Greedy & Intervalssweep-lineintervalssortinghalf-open-intervals
  • StringsEasyAuto-graded
    Shared Starting Sequence in String Array

    Determine the longest initial substring shared across every word in a given list.

    Stringsstringsarraysprefix
  • Greedy & IntervalsMediumAuto-graded
    Maximum Number With Even Counts of Ones and Twos

    Delete characters from a string of 1s and 2s so both digit counts are even, and return the largest possible number. Tests greedy subsequence construction with count constraints.

    Greedy & Intervalsgreedystringssubsequencelexicographic
  • Heaps, Sorting & SearchMediumAuto-graded
    Rank Point Pairs by Bounding Hyperrectangle Volume

    Enumerate point pairs in d dimensions, compute the volume of the box they span, drop flat boxes, and return the rest in a strict multi-key order.

    Heaps, Sorting & Searchsortingpair-enumerationgeometrymulti-key-sort
  • Dynamic ProgrammingHardAuto-graded
    Coin Pile Fusion: Who Makes the Last Merge?

    Decide the winner of a two-player impartial game where piles are fused under a size cap, using memoized game-tree search over canonical multiset states.

    Dynamic Programminggame-theorymemoizationbacktrackingbitmask-states
  • Trees & GraphsMediumAuto-graded
    Lexicographically Smallest Valid Task Schedule

    Decide whether tasks with prerequisite constraints can all be run, and if so produce the lexicographically smallest valid run order, using topological sorting with a min-heap.

    Trees & Graphstopological-sortgraphheapcycle-detection