KatInterview

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

Coding Interview Problems

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

5988
Problems
2219
Auto-graded
15
Topics
271
Added today

Showing 361–390 of 2770 results

  • 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
  • Heaps, Sorting & SearchMediumModel answer
    Ordering a Hundred Million Decimal Digits in Place

    Order a huge byte array holding only the values 0 to 9 in linear time with constant extra memory, then reason about storage layout, memory bandwidth and expected runtime.

    Heaps, Sorting & Searchcounting-sortin-placememory-bandwidthbytearray
  • 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
  • StringsMediumModel answer
    Round a Decimal String Without Using Floats

    Round a decimal number given as a string to the nearest integer, then to its last significant digit, using digit-level arithmetic and carry handling instead of floating-point types.

    Stringsstringscarry-propagationroundingparsing
  • 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
  • Data Structure DesignMediumModel answer
    Streaming Reader for a Page-Based Word Source

    Build a class that wraps a slow, paginated word API and serves exact word counts per call, keeping leftovers between calls and fetching pages lazily.

    Data Structure Designclass-designbufferingpaginationdeque
  • Arrays & HashingMediumAuto-graded
    Group Paths Whose File Contents Match Exactly

    Group file paths whose contents are identical, using cheap filters like size and digest, with an exact comparison to confirm. Output is sorted groups of two or more paths.

    Arrays & Hashinghashinggroupingstringssorting
  • Greedy & IntervalsMediumAuto-graded
    Minimum Concurrent Resources for Overlapping Intervals

    Find the maximum number of overlapping intervals at any instant using sweep line or heap techniques.

    Greedy & Intervalsintervalssweep-lineheapsorting
  • Trees & GraphsEasyAuto-graded
    Nearest Shared Ancestor in an Array-Encoded Binary Tree

    Find the deepest node that is an ancestor of two given values in a binary tree stored as a heap-indexed array, using a parent map and ancestor walk.

    Trees & Graphsbinary-treelowest-common-ancestorbfshash-map
  • Math & Bit ManipulationEasyAuto-graded
    Shelf Stock Versus Random Demand in a Checkout Line

    Compute binomial probabilities that a limited stock covers random demand from a line of customers, both as at most M buyers and as exactly M buyers.

    Math & Bit Manipulationprobabilitybinomialcombinatoricsmath
  • Greedy & IntervalsMediumAuto-graded
    Largest Set of Compatible Time Slots on One Worker

    Find the largest subset of half-open time intervals that can run on one worker without overlap, testing greedy interval selection by earliest finish.

    Greedy & Intervalsgreedyintervalssorting
  • Greedy & IntervalsMediumAuto-graded
    Fewest Badges for a Row of Scored Players

    Greedy two-pass array problem: assign the minimum total badges so each player gets at least one and any player scoring higher than an adjacent player gets strictly more badges.

    Greedy & Intervalsgreedyarraytwo-passneighbors
  • Arrays & HashingEasyAuto-graded
    Filter Names Absent From a Blocklist After Cleanup

    Return the items of one string list whose trimmed, lowercased form is missing from a second list, keeping original spelling, order, and duplicates; tests hash sets and normalization.

    Arrays & Hashinghash-setstringsnormalizationfiltering
  • Data Structure DesignMediumModel answer
    Build a Thread-Safe Cart with Pluggable Promotions

    Design an in-memory shopping cart with exact money arithmetic, strategy-based promotions, an itemized receipt, and safe concurrent updates.

    Data Structure Designobject-oriented-designstrategy-patternvalue-objectconcurrency
  • Trees & GraphsHardAuto-graded
    Schedule Tasks with Precedence Constraints

    Determine a valid sequential execution order for a set of tasks given dependency rules, or detect impossible circular dependencies.

    Trees & Graphstopological sortgraphbfsdegree count
  • Greedy & IntervalsMediumAuto-graded
    Courier Pay with Overlap Multipliers, Waits and Peak Windows

    Sweep-line over time intervals: pay grows with the square of concurrent deliveries, store-wait minutes are isolated, and peak windows double the rate.

    Greedy & Intervalssweep-lineintervalsevent-sortingsimulation