KatInterview

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

Coding Interview Problems

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

5997
Problems
2221
Auto-graded
15
Topics
270
Added today

Showing 451–480 of 2121 results

  • StringsMediumAuto-graded
    Expand a Compact Letter-and-Count String

    Parse a string of letters with optional multi-digit repeat counts, treating a missing count as one, and rebuild the expanded text in a single left-to-right pass.

    Stringsstring-parsingtwo-pointerssimulationrun-length-encoding
  • Trees & GraphsMediumAuto-graded
    Best Multi-Hop Exchange Rate Between Two Currencies

    Find the largest product of directed exchange rates along any path between two currencies, using Bellman-Ford-style relaxation on a graph that may contain cycles and rates above 1.

    Trees & Graphsgraphbellman-fordshortest-pathcurrency
  • Trees & GraphsEasyAuto-graded
    Grid Zone Coloring Feasibility

    Determine whether empty grid plots can be assigned one of k colors without adjacent conflicts.

    Trees & Graphstrees-graphsarraysmath-bits
  • Stacks & QueuesEasyAuto-graded
    Right-Side Larger Neighbor Lookup for Selected Values

    Tests whether you can precompute the nearest strictly larger value to the right for every element using a monotonic stack, then answer lookups for a chosen list of values.

    Stacks & Queuesmonotonic-stackhash-maparrays
  • Trees & GraphsMediumAuto-graded
    Grid Contagion Simulation

    Simulate multi-source BFS propagation across a 2D grid up to a maximum number of steps.

    Trees & Graphsbreadth-first-searchmatrixgraph-traversal
  • Trees & GraphsMediumAuto-graded
    Earliest Finish Time for a Dependent Job Pipeline

    Compute the shortest total time to finish all jobs with unlimited parallelism by finding the longest weighted path in a dependency graph, returning -1 if a cycle exists.

    Trees & Graphstopological-sortdaglongest-pathdynamic-programming
  • Data Structure DesignEasyAuto-graded
    In-Memory Store with Transaction Layering

    Implement an in-memory key-value database supporting GET, SET, DELETE, and nested transaction semantics (BEGIN, ROLLBACK, COMMIT).

    Data Structure Designdesign-dsstacks-queuesarraysstrings
  • Arrays & HashingMediumAuto-graded
    Count Contiguous Runs That Add Up to a Goal

    Count contiguous non-empty subarrays whose elements sum to a goal value, using running prefix sums with a frequency map to handle negatives and zeros in linear time.

    Arrays & Hashingprefix-sumhash-mapsubarraycounting
  • Data Structure DesignMediumAuto-graded
    Path-Addressed Tree Store: Replay a Command Log

    Simulate a path-keyed tree store by replaying a list of commands, testing trie or hash-map design, path validation, and exact failure semantics.

    Data Structure Designdesigntriehash-mapsimulation
  • Data Structure DesignHardAuto-graded
    Best-Fit Block Allocator with Coalescing and Log-Time Operations

    Simulate a best-fit extent allocator over a huge block range, where reserve and release must merge adjacent free runs and run in logarithmic time.

    Data Structure Designdesignordered-settreapcoalescing
  • Greedy & IntervalsMediumAuto-graded
    Fewest Rooms to Host All Bookings

    Find the smallest number of rooms that can host every booking at once, where a booking may begin the moment another one ends, using sorting and a min-heap.

    Greedy & Intervalsintervalsmin-heapsortinggreedy
  • Arrays & HashingMediumAuto-graded
    Tightest Window Covering K Different Values

    Find the minimum length of a contiguous block of an integer list containing at least k different values, using a sliding window with a frequency map.

    Arrays & Hashingsliding-windowtwo-pointershash-map
  • Data Structure DesignMediumAuto-graded
    Batch Simulation of Conflict-Free Node Locks on a Rooted Tree

    Process a batch of lock, unlock and query operations on a rooted tree where no locked node may be an ancestor or descendant of another, using subtree ranges and Fenwick trees.

    Data Structure Designtreeeuler-tourfenwick-treedesign
  • StringsMediumAuto-graded
    Fill Placeholders in a Chained Request Template

    Recursively resolve {{dotted.path}} placeholders in a nested request, keeping native types for whole-string matches and stringifying embedded ones.

    Stringsrecursionregexjsontemplate-substitution
  • Data Structure DesignMediumAuto-graded
    Simulate a Multi-User File Store with Quotas and Compression

    Simulate a command-driven in-memory file store with ownership, per-user quotas, prefix/suffix search, quota-driven eviction and size-changing renames.

    Data Structure Designdesignhash-mapsimulationsorting
  • Heaps, Sorting & SearchMediumAuto-graded
    Combine Several Pre-Sorted Lists Into One Sorted List

    Tests merging K nondecreasing integer lists into a single sorted list, preserving duplicates and handling empty lists, using a heap or pairwise merging.

    Heaps, Sorting & Searchheapmergek-way-mergesorting
  • Greedy & IntervalsMediumAuto-graded
    Fewest Segment Boosts to Make a Sequence Non-Decreasing

    Compute the minimum number of +1 contiguous-segment updates needed to make an array non-decreasing, using adjacent differences and a lower-bound argument.

    Greedy & Intervalsdifference-arraygreedyarraysrange-updates
  • StringsEasyAuto-graded
    Rearrangement Check Using Letter Tallies, No Sorting

    Decide whether two lowercase strings are rearrangements of each other using letter frequency counting in linear time, without sorting.

    Stringsstringshash-tablefrequency-countanagram
  • Data Structure DesignMediumAuto-graded
    Replay Requests Through a Per-Key Throttle

    Simulate a per-key sliding-window throttle over a batch of timed requests, tracking only accepted requests and handling window-boundary expiry correctly.

    Data Structure Designsliding-windowdequehash-mapsimulation
  • Trees & GraphsMediumAuto-graded
    Smallest Valid Order for Dependency Forest

    Construct the lexicographically smallest topological ordering of nodes in a forest defined by an ancestor/parent mapping.

    Trees & Graphstrees-graphsheaps-sortinggreedy-intervals
  • Stacks & QueuesMediumAuto-graded
    Expand Nested Repeat Patterns in an Encoded String

    Tests stack-based parsing of nested, multi-digit repeat patterns of the form count[text] to rebuild the fully expanded string.

    Stacks & Queuesstackstring-parsingnested-structuredecoding
  • Data Structure DesignMediumAuto-graded
    Simulate Snapshot Set Operations and Iterators

    Simulate mutation and snapshot iteration on a persistent set structure using interval-based logical timestamps.

    Data Structure Designdesign-dsarraysdata-structures
  • Arrays & HashingMediumAuto-graded
    Tally a Ten-Frame Pin-Knocking Game from Raw Throws

    Convert a flat list of throws into a ten-frame total, applying look-ahead bonuses for strikes and spares, including fill throws in the last frame.

    Arrays & Hashingsimulationarraylook-aheadpointer-walk
  • Trees & GraphsMediumAuto-graded
    Fewest Single-Letter Edits Through a Word List

    Tests modeling word edits as an implicit graph and running BFS with wildcard buckets to find the minimum number of one-letter changes, with careful edge cases.

    Trees & Graphsbfsgraphstringshashing
  • Greedy & IntervalsMediumAuto-graded
    Fewest Steps on a Faulty Calculator: Decrement or Double

    Find the minimum number of decrement-by-one and double operations needed to turn one positive integer into another, which rewards working backward from the target with a greedy rule.

    Greedy & Intervalsgreedymathreverse-thinking
  • StringsMediumAuto-graded
    Corridor Run With Matching Keys and Locked Doors

    Find the fewest moves along a 1D corridor with walls, keys and doors, and notice that the state space collapses to a simple prefix scan.

    Stringsbfsbitmaskstring-scanstate-space
  • Stacks & QueuesMediumAuto-graded
    Longest Stretch With Bounded Spread

    Find the longest contiguous stretch of an integer list whose largest and smallest values differ by at most a tolerance, using a sliding window with monotonic deques.

    Stacks & Queuessliding-windowmonotonic-dequearraystwo-pointers
  • Arrays & HashingEasyAuto-graded
    Order-Preserving Unique Values from a Mixed List

    Tests using a hash-based structure to drop repeated values from a list while keeping first-occurrence order, in linear time and without modifying the input.

    Arrays & Hashinghash-setordered-dictarraysdeduplication
  • Math & Bit ManipulationMediumAuto-graded
    Numerically Stable Focal Loss from Raw Scores

    Implement a class-weighted, focus-modulated binary cross-entropy directly from logits in pure Python, with stable math, input validation and sum/mean/none reductions.

    Math & Bit Manipulationnumerical-stabilitysigmoidloss-functionfloating-point
  • StringsMediumAuto-graded
    Longest Unique Sequence of Media Titles

    Find the maximum length of a contiguous subsequence of string titles containing no duplicated elements using a dynamic sliding window approach.

    Stringssliding-windowhash-tablestringsarrays