KatInterview

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

Coding Interview Problems

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

6002
Problems
2223
Auto-graded
15
Topics
273
Added today

Showing 571–600 of 2776 results

  • StringsMediumAuto-graded
    Shared-Letter Splits and Best Uniform Bundles

    Count string split points whose halves share more than k distinct characters, and find the most equal-total bundles of one or two items from a cost list, with a special rule for zero-cost items.

    Stringsstringshash-mapcountingprefix-suffix
  • Trees & GraphsMediumAuto-graded
    Best Meeting Cell on a Grid with Walls

    Find the open cell with the smallest total shortest-path distance to a set of target cells on a grid with obstacles, using BFS and reachability counting.

    Trees & Graphsbfsgridshortest-pathgraph-traversal
  • Trees & GraphsMediumAuto-graded
    Tree Depth After Splicing Out Removed Nodes

    Compute the depth of a rooted tree given as a parent array after splicing out marked nodes, so their children attach to the nearest surviving ancestor.

    Trees & Graphstreebfsparent-arraydepth
  • Heaps, Sorting & SearchEasyAuto-graded
    Stream Median Tracker

    Process a series of dynamic data stream queries to compute the median on demand using heap-based structures.

    Heaps, Sorting & Searchheapsheapqdata-structuresdesign-ds
  • Data Structure DesignMediumAuto-graded
    Most Connected User Tracker with Variable Top-K Queries

    Maintain distinct-contact counts for users from undirected messages, answer the top user in O(1), and return a top-k list with deterministic tie-breaking.

    Data Structure Designhash-sethash-mapheapsimulation
  • Stacks & QueuesMediumAuto-graded
    Strip Unmatched Brackets From a Text Line

    Delete exactly the brackets that cannot be paired so the remaining text is well-formed, using a single linear scan with a stack or counters.

    Stacks & Queuesstackstringparenthesesgreedy
  • Dynamic ProgrammingMediumAuto-graded
    Calculate Processed Work Units in Pipelined Task Queues

    Simulate task batch execution across a sequential multi-stage pipeline and count total units completed within a time limit.

    Dynamic Programmingarrayssimulationdynamic-programminggreedy-intervals
  • Dynamic ProgrammingMediumAuto-graded
    Best Haul from a Line of Stalls Without Neighbors

    Compute the maximum total from a line of non-negative numbers when no two neighboring entries may both be picked, using linear-time dynamic programming.

    Dynamic Programmingdynamic-programmingarraytake-or-skiphouse-robber
  • 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
  • Data Structure DesignHardModel answer
    Hardening a Coalescing TTL Cache: Failures, Invalidation, Eviction

    Review a promise-coalescing TTL cache in TypeScript, find its failure, invalidation and memory bugs, write a fixed version, and explain how to port it safely to multithreaded C++20.

    Data Structure Designasynccacherace-conditionslru
  • 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 & GraphsMediumModel answer
    Two Warm-Ups: One-Deletion Palindrome and Column-Grouped Tree Output

    Decide whether a string becomes a palindrome after removing at most one character, then group a binary tree's node values by column using level-order tie-breaking.

    Trees & Graphstwo-pointerspalindromebfsbinary-tree
  • 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 DesignMediumModel answer
    Build an In-Memory Price History Store with One-Shot Updates

    Design a per-symbol price store supporting lookups, custom change formulas, atomic range updates that can touch each slot only once, and a switch from daily to hourly data.

    Data Structure Designdata-structure-designtime-seriesatomic-updateshash-map
  • 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
  • Data Structure DesignMediumModel answer
    Binary Wire Format for a Nested Key-Value Map

    Design and implement a versioned, checksummed binary format that converts a nested key-value map to bytes and back, and compare it with JSON and MessagePack.

    Data Structure Designserializationbinary-formatchecksumversioning
  • 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
  • Data Structure DesignHardModel answer
    Design an In-Memory Sentence Search Index

    Design a data structure that supports adding, removing, and efficiently querying sentences by keyword in real time.

    Data Structure DesignData Structure DesignInverted IndexStringHash Table