KatInterview

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

Coding Interview Problems

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

6008
Problems
2226
Auto-graded
15
Topics
273
Added today

Showing 631–660 of 2126 results

  • Greedy & IntervalsMediumAuto-graded
    Even Budget Split Under Per-Person Caps

    Split a budget as evenly as possible among people with individual caps, using a binary-searched fill level plus a lowest-index-first remainder rule.

    Greedy & Intervalsgreedybinary-searchwater-fillingarrays
  • StringsEasyAuto-graded
    Match Words to a Keypad Number Sequence

    Given a word list and a string of keypad digits, return the sorted words whose letters map to exactly that digit sequence, testing string encoding and filtering.

    Stringsstringshashingsortingsimulation
  • Arrays & HashingMediumAuto-graded
    Count Disjoint Pairs That Add Up to a Goal Value

    Find the most disjoint pairs in an integer list whose sum equals a goal, using value counts or sorting with two pointers, while handling duplicates, negatives and the half-goal case.

    Arrays & Hashinghash-maptwo-pointersgreedycounting
  • Heaps, Sorting & SearchMediumAuto-graded
    Locate the K-th Dominant Value

    Find the k-th largest integer in an unsorted list efficiently using quickselect or priority queues.

    Heaps, Sorting & Searchheaps-sortingarraysquickselect
  • Heaps, Sorting & SearchMediumAuto-graded
    Find Unique Combination Triples for Target Sum

    Find all distinct non-decreasing 3-element value combinations in an array that add up to a specified target value.

    Heaps, Sorting & Searcharrayssortingtwo-pointers
  • Stacks & QueuesMediumAuto-graded
    Validate Deep Structure Equivalence

    Recursively or iteratively check if two arbitrarily nested data structures are identical in type, shape, and value.

    Stacks & Queuesrecursionstackdata-structureshashing
  • Dynamic ProgrammingMediumAuto-graded
    Pair Workers With Distinct Stations at Minimum Grid Distance

    Match each point in one list to a different point in a larger list so the total Manhattan distance is minimal, which suits a bitmask DP given the small limits.

    Dynamic Programmingbitmask-dpassignment-problemmanhattan-distance
  • Arrays & HashingMediumAuto-graded
    Count Maximum Disjoint Pairs Summing to a Target

    Find the most index-disjoint pairs in an integer array whose values add up to a target, testing hashing of complements, counting, and handling of the self-pairing case.

    Arrays & Hashinghash-mapcountingtwo-pointersgreedy
  • Stacks & QueuesEasyAuto-graded
    Cancel Neighboring Letter Pairs in a String

    Tests using a stack to repeatedly cancel adjacent equal characters in a string, including cascading cancellations, in linear time.

    Stacks & Queuesstackstringsimulation
  • Stacks & QueuesMediumAuto-graded
    Per-Function Self Time from a Call Trace

    Sweep a single-threaded call trace with a stack to total each function's self time under half-open intervals, with recursion, strict validation, and name-sorted output.

    Stacks & Queuesstacksimulationhash-mapvalidation
  • StringsEasyAuto-graded
    Earliest Non-Repeating Symbol Position

    Locate the index of the earliest symbol in an alphanumeric string that occurs only once, using frequency counting and an ordered scan, or return -1.

    Stringshash-mapcountingstringtwo-pass
  • Heaps, Sorting & SearchMediumAuto-graded
    Simulate Multi-Timer Expiry with Single System Timer

    Simulate the execution and triggering order of multiple scheduled timers using a min-heap under system clock advancements.

    Heaps, Sorting & Searchheappriority-queuedesignsimulation
  • Trees & GraphsMediumAuto-graded
    Determine Build Task Schedule

    Find a valid topological sequence for tasks with prerequisite constraints or detect cyclic dependencies.

    Trees & Graphsgraphtopological-sortbfsdfs
  • StringsEasyAuto-graded
    Run Strings Through a Two-Letter State Machine

    Simulate a partial deterministic automaton over the letters a and b, handling missing transitions, invalid symbols and empty input, and report acceptance for a batch of query strings.

    Stringssimulationhash-mapstate-machinestrings
  • Dynamic ProgrammingMediumAuto-graded
    Smallest Fully Bracketed Arithmetic Expression Hitting a Target

    Enumerate all operator and bracket choices over an ordered list of numbers and return the ASCII-smallest canonical expression that evaluates to the target, or an empty string.

    Dynamic Programmingrecursioninterval-dpexpression-treesmemoization
  • Data Structure DesignMediumAuto-graded
    Design an In-Memory Reservation Manager

    Implement an in-memory venue reservation system supporting quick seat allocation, cancellation tracking, and capacity queries.

    Data Structure Designhash-tabledesignstacksdata-structures
  • Math & Bit ManipulationEasyAuto-graded
    Five Quick Quantitative Puzzles with Exact String Answers

    Solve five short arithmetic and algebra puzzles (units, compounding percentages, linear system, rate, series scaling) and return them in an exact string format.

    Math & Bit Manipulationmatharithmeticalgebraunit-conversion
  • StringsMediumAuto-graded
    Longest Window Where Every Letter Meets a Minimum Count

    Find the longest contiguous substring in which every letter that appears occurs at least k times, using a sliding window or divide and conquer.

    Stringssliding-windowstringshash-mapdivide-and-conquer
  • Math & Bit ManipulationMediumAuto-graded
    Approximate a Square Root to the Nearest Tenth

    Compute the square root of a non-negative number without a built-in root function and return it rounded to one decimal place, using bisection or Newton's method.

    Math & Bit Manipulationbinary-searchnumerical-methodsfloating-pointmath
  • Math & Bit ManipulationEasyAuto-graded
    Possible Subspace Intersection Dimensions

    Computes all valid integer dimensions for the intersection of two vector subspaces given ambient and subspace dimensions.

    Math & Bit Manipulationmathlinear-algebra
  • Arrays & HashingMediumAuto-graded
    Closest Bakery Stall for Every Shopper on a Street

    For each shopper on a line, find the closest stall index, with ties going to the lower index, testing two-sided linear scans for nearest-neighbor lookups.

    Arrays & Hashingarraystwo-pointersprefix-suffixnearest-neighbor
  • Math & Bit ManipulationMediumAuto-graded
    Firewall Rule Resolver with Longest-Prefix Priority

    Resolve an IPv4 address against CIDR allow/deny rules using longest-prefix precedence, later-rule tie-breaking, and a default of deny, via bitmask matching.

    Math & Bit Manipulationbit-manipulationcidripv4simulation
  • Dynamic ProgrammingHardAuto-graded
    Visit Every Node Exactly Once: Path Existence in a Small Graph

    Decide whether an undirected graph of at most 20 vertices has a simple path through every vertex, which is best solved with a bitmask DP over visited subsets.

    Dynamic Programmingbitmask-dpgraphhamiltonian-pathsubsets
  • Math & Bit ManipulationMediumAuto-graded
    Enumerate Every Factor of a Large Integer in Sorted Order

    Produce all positive factors of an integer up to 10^12 in increasing order, handling perfect squares and large primes, and consider approaches faster than a square-root scan.

    Math & Bit Manipulationnumber-theorydivisorsfactorizationsquare-root
  • Heaps, Sorting & SearchMediumAuto-graded
    Lowest-Sum Pairs Across Two Sorted Lists

    Select the k cheapest cross-array pairs from two sorted lists using a heap-based k-way merge, with a deterministic ordering for ties.

    Heaps, Sorting & Searchheapk-way mergesorted arrayspriority queue
  • Trees & GraphsMediumAuto-graded
    Tree Span and Grid Escape: Two Graph Queries in One Call

    Compute a tree's longest path in edges and the shortest 4-directional route through a grid with obstacles, returning both results together.

    Trees & Graphsbfstree-diametershortest-pathgrid
  • Data Structure DesignMediumAuto-graded
    Chat Activity Tracker with a Rolling 15-Minute Window

    Simulate a chat activity tracker with a closed rolling window, touch/close liveness rules, and out-of-order events, using bounded-memory eviction.

    Data Structure Designdesignhash-mapheapsliding-window
  • Stacks & QueuesEasyAuto-graded
    Collapse Repeated Letters: Pair Cancel or Full Run Wipe

    Simulate cascading deletions of equal neighbouring letters with a stack, either cancelling pairs or erasing whole leftmost runs, and return what is left.

    Stacks & Queuesstackstringsimulationrun-length
  • Arrays & HashingMediumAuto-graded
    Count Index Pairs With a Fixed Value Gap

    Count index pairs i < j whose values differ by exactly k, using a frequency map and handling the k = 0 case separately to avoid double counting.

    Arrays & Hashinghash-mapcountingfrequencypairs
  • Heaps, Sorting & SearchMediumAuto-graded
    Budget Growth Through Threshold-Locked Ventures

    Greedy plus min-sorted unlocking and a max-heap: pick up to k ventures, each requiring a minimum budget, to maximize the final budget.

    Heaps, Sorting & Searchgreedyheapsortingpriority-queue