KatInterview

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

Coding Interview Problems

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

5969
Problems
2211
Auto-graded
15
Topics
273
Added today

Showing 2701–2730 of 2761 results

  • 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
  • Math & Bit ManipulationHardAuto-graded
    Balanced-Radix Digital Root Collision Finder

    Tests mastery of base conversion and number theory by finding all integers in a range whose digital roots are identical across two different bases.

    Math & Bit Manipulationmathbit manipulationbase conversionnumber theory
  • Math & Bit ManipulationMediumAuto-graded
    Smallest Integer Divisible by All Values in Every Subarray of Length K

    Tests the ability to combine sliding-window enumeration with LCM/GCD reasoning to find the minimum positive integer that is simultaneously divisible by every contiguous subarray LCM.

    Math & Bit Manipulationmathgcd/lcmsliding window
  • Math & Bit ManipulationMediumAuto-graded
    Modular Exponentiation Tower (Tetration mod M)

    Tests mastery of modular arithmetic by computing a power tower (iterated exponentiation) modulo M using Euler's theorem and recursive modular exponentiation.

    Math & Bit Manipulationmathmodular arithmeticnumber theory
  • Stacks & QueuesEasyAuto-graded
    Find the Nearest Taller Building to the Left

    Tests the ability to use a monotonic stack to efficiently find, for each building in a skyline, the index of the nearest building to its left that is strictly taller.

    Stacks & Queuesmonotonic stackarraysstack
  • Data Structure DesignEasyAuto-graded
    Flatten and Iterate a Nested Registry

    Tests the ability to implement a depth-first iterator over arbitrarily nested lists and dicts that yields leaf values in traversal order.

    Data Structure Designdata structuresiterationrecursion
  • Dynamic ProgrammingEasyAuto-graded
    Minimum Cost to Visit All Booths at a Fair

    Tests bitmask DP on small n by finding the minimum total travel cost to visit every booth at a fair, starting and ending at the entrance.

    Dynamic Programmingdynamic programmingbitmask DPgraphs
  • Stacks & QueuesHardAuto-graded
    Maximum Visible Buildings on a Skyline Strip

    Tests ability to use a monotonic stack to compute, for each building, how many previous buildings it "blocks" and find the building that maximally reduces the visible skyline count.

    Stacks & Queuesmonotonic stackarrayssimulation
  • Linked ListsEasyAuto-graded
    Merge K Sorted Linked-List Segments Into One

    Tests ability to merge multiple sorted runs stored as a flat list of values, exercising the core linked-list merge-sorted-runs technique in pure Python.

    Linked Listslinked listsmergingsorting
  • Math & Bit ManipulationHardAuto-graded
    Count Permutations With Exact Inversion Pairs

    Tests deep combinatorics knowledge by counting permutations of 1..n that have exactly k inversions, using the Mahonian distribution and efficient DP with modular arithmetic.

    Math & Bit Manipulationcombinatoricsdynamic programmingnumber theory
  • Linked ListsHardAuto-graded
    Find All Rho-Shape Cycle Tails in a Functional Graph

    Tests cycle detection via Floyd's / index-chasing on a pure-array functional graph, requiring candidates to identify every node's "tail length" before it enters a cycle.

    Linked Listslinked listscycle detectiongraphsarrays
  • Dynamic ProgrammingHardAuto-graded
    Collect Keys on a Grid with Locked Doors

    Tests grid-path DP where the traveler must collect keys to unlock doors, requiring bitmask state to track which keys have been picked up.

    Dynamic Programmingdynamic programmingbitmaskgridBFS/DP