KatInterview

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

Coding Interview Problems

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

5986
Problems
2219
Auto-graded
15
Topics
271
Added today

Showing 271–300 of 2119 results

  • 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
  • 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
  • Dynamic ProgrammingMediumAuto-graded
    Booth Assignment Plan: Cheapest Non-Repeating Color Sequence

    Choose one of three colors per day to minimize total cost with no color on two adjacent days, then return the actual sequence using DP with backtracking.

    Dynamic Programmingdynamic-programmingpath-reconstructionarrays
  • Data Structure DesignMediumAuto-graded
    Seat Assignment with Forward-Only Probing on a Fixed Row

    Decide whether every request in a sequence can be seated in a fixed row when taken spots push it to the next free higher slot; tests efficient next-free-slot lookup, e.g. with union-find.

    Data Structure Designunion-findsimulationarraysgreedy
  • StringsEasyAuto-graded
    Screen Pasted Card Numbers: Format, Issuer Prefix and Luhn

    Filter strings by a character and length rule, an issuer-prefix range and the Luhn checksum, returning the original text of each valid entry in input order.

    Stringsstringsvalidationluhnsimulation
  • Trees & GraphsMediumAuto-graded
    Rank Suggested Connections by Shared Friends

    Build an undirected graph from friendship pairs, then rank every non-friend of a target user by mutual friends, degree and ID using a composite sort key.

    Trees & Graphsgraphadjacency-listsortingsets
  • Dynamic ProgrammingMediumAuto-graded
    Maximum Earnings from Back-to-Back Booking Slots

    Pick non-overlapping time slots, where one may begin exactly as another finishes, to maximize total payout; tests weighted interval scheduling with sorting, DP and binary search.

    Dynamic Programmingdynamic-programmingbinary-searchintervalssorting
  • Arrays & HashingEasyAuto-graded
    Compute Usage and Quality Metrics from Workplace Search Logs

    Aggregate a list of search log records into funnel, quality, latency and repeat-usage metrics, handling empty input and even-length medians.

    Arrays & Hashinghash-mapaggregationsimulationmedian
  • Trees & GraphsMediumAuto-graded
    Schedule Courses Under Prerequisite Rules

    Produce a deterministic course order that respects prerequisite pairs using a queue-based topological sort, or an empty list if the prerequisites contain a cycle.

    Trees & Graphstopological-sortgraphbfscycle-detection
  • Data Structure DesignMediumAuto-graded
    Prioritized Delayed Job Queue Simulator

    Simulate a delayed job queue by replaying a log of schedule, reschedule, cancel and poll operations, returning each result in order while respecting priority and time ordering.

    Data Structure Designheaphash-mapsimulationlazy-deletion
  • Math & Bit ManipulationMediumAuto-graded
    Pair Growth by Adding One Coordinate to the Other

    Decide whether a positive integer pair can grow into a target pair by repeatedly adding one coordinate to the other, using reverse-step reasoning and Euclid-style reduction.

    Math & Bit Manipulationmatheuclidean-algorithmreverse-simulationnumber-theory
  • Data Structure DesignMediumAuto-graded
    Track and Analyze Obstacle Course Runs

    Simulate obstacle course data structures, track per-stage times, calculate target metrics, and run Monte Carlo probability estimation.

    Data Structure Designdesign-dsarraysstatistics
  • Arrays & HashingEasyAuto-graded
    95% Z-Interval for a Mean with Known Standard Deviation

    Compute a 95% z-based confidence interval for a population mean from a sample mean, known population standard deviation, and sample size, using the standard error.

    Arrays & Hashingconfidence-intervalcentral-limit-theoremstandard-errora-b-testing
  • Heaps, Sorting & SearchMediumAuto-graded
    Build a Max-Heap In Place with Bottom-Up Sifting

    Convert an integer list into a max-heap layout using the bottom-up sift-down procedure, matching an exact output array including tie-break behavior.

    Heaps, Sorting & Searchheaparraysift-downin-place