KatInterview

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

Coding Interview Problems

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

5966
Problems
2209
Auto-graded
15
Topics
271
Added today

Showing 1–30 of 2109 results

  • Math & Bit ManipulationMediumAuto-graded
    Largest Letter Coverage from Non-Overlapping Words

    Choose words with no repeated letters that share no letters with each other, maximizing total letters covered; tests bitmask encoding and pruned backtracking.

    Math & Bit Manipulationbitmaskbacktrackingset-packingpruning
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Overlapping Time Intervals

    Evaluate ability to sort and combine overlapping or adjacent half-open numerical intervals in linear-arithmetic time.

    Greedy & Intervalsintervalssortingarraysgreedy
  • Heaps, Sorting & SearchEasyAuto-graded
    Adaptive Merge Sort with Comparison Counter

    Count element-level comparisons during an adaptive divide-and-conquer merge sort.

    Heaps, Sorting & Searchsortingdivide-and-conquerrecursionarrays
  • Arrays & HashingMediumAuto-graded
    Shortest Window Holding Exactly k Different Values

    Find the shortest contiguous slice of an integer list containing exactly k different values, using a sliding window with frequency counts.

    Arrays & Hashingsliding-windowhash-mapsubarraytwo-pointers
  • Math & Bit ManipulationEasyAuto-graded
    Theoretical Mean and Variance of Permutation Inversions

    Derive and evaluate the closed-form expected value and variance for the number of inversions in a uniformly random permutation.

    Math & Bit Manipulationmathcombinatoricsstatisticsprobability
  • Arrays & HashingEasyAuto-graded
    Check a Call Against a Catalog of Function Signatures

    Decide whether an ordered list of argument types fits any function in a catalog, given required, trailing optional, and variadic parameters with exact type matching.

    Arrays & Hashingsimulationarray-scanningsignature-matchingedge-cases
  • Trees & GraphsMediumAuto-graded
    Stop Listing and Indented Reporting Tree from Raw Inputs

    Parse a JSON string into formatted stop lines and turn employee rows into a sorted, indented reporting-tree outline using an adjacency list and iterative DFS.

    Trees & Graphsjsontreedfssorting
  • Linked ListsMediumAuto-graded
    Min, Reverse, and Staircase Search in One Function

    Compute a list's minimum, its reversal, and whether a target exists in a row- and column-sorted matrix, all in one combined function.

    Linked Listslinked-listreversalmatrix-searchtwo-pointers
  • Trees & GraphsMediumAuto-graded
    Smallest-First Course Ordering With Cycle Check

    Produce the lexicographically smallest valid course order from prerequisite pairs, or an empty list if a cycle makes it impossible, using a topological sort with a min-heap.

    Trees & Graphstopological-sortgraphheapcycle-detection
  • Data Structure DesignMediumAuto-graded
    Locate a Traveler's Airport by Timestamp

    Process a batch of operations that load travel records and answer per-user point-in-time location queries using grouping, sorting and binary search.

    Data Structure Designbinary-searchhash-mapintervalsdesign
  • Arrays & HashingMediumAuto-graded
    Shortest Subarray with K Unique Values

    Find the minimum length of a contiguous subarray containing at least K unique elements using a sliding window.

    Arrays & Hashingsliding-windowtwo-pointershash-tablearrays
  • Trees & GraphsMediumAuto-graded
    Minimum Grid Manhattan Distance Between Target Characters

    Find the minimum Manhattan distance between any pair of target characters in a 2D character grid.

    Trees & Graphsbfsmatrixdistance-transformgraphs
  • Heaps, Sorting & SearchMediumAuto-graded
    Rolling Window Mean After Dropping the Largest k

    Compute the mean of each fixed-size window after discarding its k largest values, which needs a structure that supports fast insertion, deletion and sum-of-smallest queries.

    Heaps, Sorting & Searchsliding-windowfenwick-treeorder-statisticsheaps
  • Data Structure DesignMediumAuto-graded
    Room Assignment and Leaderboard for Streaming Sessions

    Simulate a stream of operations that assigns sessions to the lowest-numbered free room and reports the top-k streams by total duration, tested with heaps and lazy deletion.

    Data Structure Designheapdesignsimulationlazy-deletion
  • Dynamic ProgrammingMediumAuto-graded
    Process Morse Signals and Provider Coverage

    Evaluate string encoding, ambiguous Morse code decoding via dynamic programming, and spatial coverage checking for network members.

    Dynamic Programmingdynamic-programmingstringsarraysgeometry
  • Trees & GraphsHardAuto-graded
    Dictionary Words Hidden in a Letter Grid

    Find every dictionary word that can be traced through adjacent, non-repeating cells of a letter grid, which rewards sharing prefixes across words instead of searching per word.

    Trees & Graphstriebacktrackingdfsgrid
  • Data Structure DesignEasyAuto-graded
    Sliding Five-Minute Hit Tally for Each Caller

    Process a batch of hit and query operations, returning each caller's number of hits within an inclusive 300-second window, using per-caller queues with lazy expiry.

    Data Structure Designhash-mapqueuesliding-windowsimulation
  • StringsMediumAuto-graded
    Alphabetically Greatest Tail of a String

    Find the lexicographically greatest suffix of a long lowercase string in linear time by comparing candidate start positions without copying and skipping eliminated blocks.

    Stringsstringstwo-pointersgreedysuffix
  • Data Structure DesignHardAuto-graded
    Best-Fit Block Manager with Splitting and Merging

    Simulate a best-fit memory manager on a fixed address range, handling splits, exact-start frees, invalid frees, and merging of neighboring free blocks using plain lists.

    Data Structure Designsimulationbinary-searchmemory-allocatorbest-fit
  • Math & Bit ManipulationMediumAuto-graded
    Implement Binary Exponentiation

    Evaluate floating-point powers with integer exponents using logarithmic time binary exponentiation without standard library power methods.

    Math & Bit Manipulationmathbinary-exponentiationbit-manipulation
  • Greedy & IntervalsMediumAuto-graded
    Pair Lab Visits with Follow-Up Consultations from 10-Minute Slots

    Validate and merge 10-minute availability slots, expand them into 30-minute visits, and list every lab-then-consultation pairing with a wait of 0 to 60 minutes.

    Greedy & Intervalsintervalsmergingbinary-searchsorting
  • Math & Bit ManipulationMediumAuto-graded
    Maximize Expected Return in Two Opaque Containers Game

    Find the optimal sequence of deposit and collection moves to maximize expected value in an unobserved two-container game.

    Math & Bit Manipulationprobabilityexpected-valuegreedymath
  • Arrays & HashingEasyAuto-graded
    Maximum Gain from Single Asset Trade

    Determine the maximum possible gain achieved by completing at most one purchase and sale transaction over a sequence of prices.

    Arrays & Hashingarraysgreedyprefix-minimum
  • Data Structure DesignMediumAuto-graded
    Smallest Free Label per Category: Batch Simulation

    Simulate a sequence of allocate and release operations on independent categories, always handing out the smallest free positive integer, using a counter plus a min-heap per category.

    Data Structure Designheaphash-mapsimulationdesign
  • Data Structure DesignMediumAuto-graded
    Design an In-Memory Key-Value Engine with Transactions

    Implement an in-memory key-value database supporting frequency counting and nested transaction rollbacks.

    Data Structure Designhash-tablestackdesigndata-structures
  • Data Structure DesignEasyAuto-graded
    Simulate a Time-To-Live (TTL) Key-Value Store

    Process a series of operations on an in-memory key-value store with fixed time-to-live expiration dynamics.

    Data Structure Designdesign-dshash-table
  • Heaps, Sorting & SearchMediumAuto-graded
    Podium Finish: Pick the Two Best Clubs in a League Table

    Rank teams with a multi-level tiebreak (points, goal difference, goals scored, index) and return the best two indices, testing composite keys and efficient selection.

    Heaps, Sorting & Searchsortingtuple-keystie-breakingselection
  • Arrays & HashingMediumAuto-graded
    Leave-One-Out Products Without Using Division

    Build an array where each entry is the product of all other entries, without division, in linear time, using prefix and suffix running products.

    Arrays & Hashingprefix-productsuffix-productarrayin-place
  • Stacks & QueuesEasyAuto-graded
    Typed Value Stack Interpreter with Mixed Addition

    Simulate a stack machine whose values are tagged ints or strings, where ADD sums two ints or concatenates otherwise, and return the printed lines.

    Stacks & Queuesstacksimulationstringstagged-union
  • Trees & GraphsMediumAuto-graded
    Minimum Hops Between Two Tasks in a Dependency Graph

    Find the fewest directed edges from a start node to a goal node in an acyclic graph, returning 0 for identical nodes and -1 when unreachable; tests BFS on unit-weight graphs.

    Trees & Graphsgraphbfsshortest-pathdag