KatInterview

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

Coding Interview Problems

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

5972
Problems
2212
Auto-graded
15
Topics
273
Added today

Showing 2041–2070 of 2112 results

  • Stacks & QueuesEasyAuto-graded
    Print Queue Page Order Simulator

    Tests queue simulation by modeling a shared printer that interleaves multi-page jobs across rounds, returning the final page-output order.

    Stacks & Queuesqueuesimulationarrays
  • Stacks & QueuesHardAuto-graded
    Reconstruct Function Entry/Exit Events from Call Stack Snapshots

    Tests ability to compute positional diffs between consecutive call stack snapshots and emit correctly ordered START/END events using a stack-based mental model.

    Stacks & Queuesstacksimulationstring manipulation
  • Trees & GraphsMediumAuto-graded
    Schedule Dependent Tasks with Priority and Tag Exclusion

    Tests Kahn's algorithm with deterministic tie-breaking, urgency-based heap ordering, cycle detection with path reporting, and transparent skipping of tag-excluded tasks.

    Trees & Graphstopological-sortheapgraphs
  • Heaps, Sorting & SearchMediumAuto-graded
    Schedule Tasks by Deadline and Priority

    Tests the ability to sort a list of tasks using a multi-key custom comparator involving deadlines, priorities, and tie-breaking rules.

    Heaps, Sorting & Searchsortingcustom sort keysheaps
  • StringsEasyAuto-graded
    Shortest Palindromic Superstring by Suffix–Prefix Overlap

    Tests understanding of palindromic structure by finding the minimum characters to append to a string to make the whole string a palindrome.

    Stringsstringspalindrometwo pointers
  • StringsMediumAuto-graded
    Shortest Substring Containing All Required Characters

    Tests the sliding window pattern with frequency counting to find the shortest substring of one string that covers every character (with multiplicity) of another.

    Stringssliding-windowhash-maptwo-pointers
  • Stacks & QueuesHardAuto-graded
    Simulate a Multi-Lane Toll Plaza Queue

    Tests queue simulation skills by modeling vehicles routing through toll lanes with dynamic overflow and lane-closing logic.

    Stacks & Queuesqueuesimulationgreedy
  • Data Structure DesignMediumAuto-graded
    Sliding-Window Rate Limiter Over Event Timestamps

    Tests the ability to implement a sliding-window rate limiter that, given a log of request timestamps, determines which requests are allowed under a fixed-window capacity.

    Data Structure Designdata structuresrate limitersliding window
  • Data Structure DesignHardAuto-graded
    Stateful Activity Window Aggregation Over an Event Stream

    Tests whether a candidate can maintain per-user rolling time windows over a chronologically ordered stream and emit aggregated records incrementally without buffering the whole input.

    Data Structure Designhash-mapsimulationstreamingaggregation
  • Trees & GraphsMediumAuto-graded
    Sum of Decimal Paths in a Binary Tree

    Tests depth-first (or breadth-first) traversal of a binary tree while tracking the accumulated digit value along each root-to-leaf path.

    Trees & Graphsbinary-treebfsdfs
  • Math & Bit ManipulationMediumAuto-graded
    Sum of Digits Across All Bases from 2 to K

    Tests ability to repeatedly convert an integer into multiple bases and accumulate digit sums, combining base-conversion mechanics with modular arithmetic.

    Math & Bit Manipulationmathbit manipulationbase conversion
  • Stacks & QueuesHardAuto-graded
    Validate Nested Tag Expressions with Typed Bracket Rules

    Tests bracket matching using a stack to enforce context-sensitive nesting rules across four distinct bracket types with extra validity constraints.

    Stacks & Queuesstacksbracket matchingparsingsimulation
  • Trees & GraphsMediumAuto-graded
    Recover Build Order From Incremental Patch Dependencies

    Tests whether candidates can apply topological sort (Kahn's algorithm or DFS) to determine a valid linear build order from a dependency graph of software patches.

    Trees & Graphsgraphstopological sortBFSKahn's algorithm
  • Dynamic ProgrammingMediumAuto-graded
    Collect Gems in a Grid with Fatigue Penalty

    Tests grid-path DP with a carried state (fatigue level) that penalizes consecutive moves in the same direction, requiring careful state-space design and memoization.

    Dynamic Programmingdynamic programminggridmemoizationstate machine
  • Heaps, Sorting & SearchEasyAuto-graded
    Top-K Most Frequent Words With Tie-Breaking

    Tests ability to retrieve the k most frequent words from a list, using lexicographic order as a tie-breaker, via a heap or sort-based approach.

    Heaps, Sorting & Searchheapsortinghash map
  • Stacks & QueuesHardAuto-graded
    Largest Rectangle Under a Skyline with Forbidden Zones

    Tests the ability to apply a monotonic stack to find the largest rectangular area under a histogram while skipping columns that are marked as forbidden.

    Stacks & Queuesmonotonic stackarraysgeometry
  • Stacks & QueuesMediumAuto-graded
    Validate Nested Markup Tag Sequence

    Tests bracket matching logic by verifying that a simplified markup string with typed opening/closing tags is correctly nested and properly closed.

    Stacks & Queuesstackparsingsimulation
  • Arrays & HashingEasyAuto-graded
    Longest Subarray with At Most K Distinct Flavors

    Tests the classic sliding window pattern for finding the longest contiguous subarray containing at most K distinct values.

    Arrays & Hashingarrayssliding windowhash map
  • Linked ListsHardAuto-graded
    Detect Merge Point of Two Rho-Shaped Index Chains

    Tests mastery of Floyd's cycle-detection algorithm and two-pointer merge-point finding applied to implicit linked lists encoded as index arrays.

    Linked Listslinked listscycle detectiontwo pointers
  • Stacks & QueuesMediumAuto-graded
    Validate Nested Scope Tags with Typed Bracket Pairs

    Tests bracket matching by parsing a string of typed scope-open/close tokens and verifying correct nesting, ordering, and balance according to a precedence table.

    Stacks & Queuesstacksbracket matchingparsingsimulation
  • Dynamic ProgrammingMediumAuto-graded
    Maximize Museum Tour Value With Energy Budget

    Tests the 0/1 knapsack variant where you allocate a fixed energy budget across museum exhibits with costs and values, but some exhibits are only accessible after visiting a prerequisite.

    Dynamic Programmingdynamic programmingknapsackprerequisites
  • Math & Bit ManipulationMediumAuto-graded
    Time 45 Minutes Using Two Non-Uniform Burning Cords

    Tests logical reasoning about burn-time budgets and how lighting both ends of a cord precisely halves its remaining duration regardless of density.

    Math & Bit Manipulationlogicreasoningmath
  • Trees & GraphsHardAuto-graded
    Minimum Batches to Complete All Courses with Prerequisites

    Tests topological ordering (Kahn's algorithm / BFS layering) to schedule dependent courses into the fewest sequential batches where each batch runs in parallel.

    Trees & Graphsgraphstopological-sortBFS
  • Heaps, Sorting & SearchEasyAuto-graded
    Top-K Most Frequent Words by Score

    Tests ability to rank words by a weighted frequency-length score, applying top-k selection with a precise tie-breaking rule.

    Heaps, Sorting & Searchheapsortingtop-kstrings
  • StringsMediumAuto-graded
    Group Cipher Variants by Scrambled Key

    Tests anagram-grouping on structured strings with a prefix/suffix schema, requiring careful key extraction, normalization, and tie-breaking for sorted output.

    Stringsstringsanagram groupingsortingparsing
  • Data Structure DesignMediumAuto-graded
    Simulate a Frequency-Eviction Cache (LFU Cache)

    Tests ability to simulate a Least-Frequently-Used cache by processing a sequence of get/put operations and returning the complete history of return values.

    Data Structure Designdata structurescachesimulationhash map
  • StringsMediumAuto-graded
    Group Scrambled Words by Shared Anagram Fingerprint

    Tests the ability to canonicalize strings into sorted-character keys and cluster words that are anagrams of each other, with a precise tie-breaking rule for deterministic output.

    Stringsstringsanagramshash mapsorting
  • Linked ListsEasyAuto-graded
    Find the Entry Point of a Rho-Shaped Index Chain

    Tests cycle detection on implicit linked lists encoded as index arrays, applying Floyd's tortoise-and-hare algorithm to find where a cycle begins.

    Linked Listslinked listscycle detectiontwo pointers
  • Math & Bit ManipulationHardAuto-graded
    Minimum LCM Spanning Value of a Sequence

    Tests deep understanding of GCD/LCM relationships by finding the smallest integer ≥ 1 that, when inserted into an array, minimises the LCM of the entire resulting sequence.

    Math & Bit Manipulationmathgcd/lcmnumber theory
  • Greedy & IntervalsMediumAuto-graded
    Minimum Penalty Class Schedule with Fixed Breaks

    Tests whether a candidate can apply an exchange-argument greedy to order tasks with deadlines and penalties to minimize total weighted lateness, with fixed unavailable time windows.

    Greedy & Intervalsgreedyintervalsschedulingexchange argument