KatInterview

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

Coding Interview Problems

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

6000
Problems
2221
Auto-graded
15
Topics
273
Added today

Showing 2251–2280 of 2774 results

  • Trees & GraphsMediumModel answer
    Multi-Problem Algorithm Sprint: Trees, Grids, and Heaps

    Implement six independent algorithm problems covering BST operations, tree traversals, optimization, and graph exploration with correctness and complexity analysis.

    Trees & Graphsbinary-treesbinary-search-treesgraph-traversaloptimization
  • StringsMediumAuto-graded
    Minimum Edits to Make a String k-Palindromic

    Tests the ability to combine classic edit-distance dynamic programming with palindrome structure to find the minimum single-character substitutions needed to make a string palindromic after removing exactly k characters.

    Stringsstringsdynamic-programmingedit-operations
  • Trees & GraphsMediumAuto-graded
    Build Installation Order from Package Dependencies

    Tests graph traversal with cycle detection to compute a valid installation sequence for packages with dependencies.

    Trees & Graphsgraph-traversaltopological-sortcycle-detectiondfs
  • Heaps, Sorting & SearchMediumModel answer
    Streaming Weighted Reservoir Sampling Without Replacement

    Implement a single-pass, memory-efficient weighted sampler that draws k distinct items proportional to weight from a potentially huge stream.

    Heaps, Sorting & Searchreservoir-samplingprobabilitynumerical-stabilityheap
  • Trees & GraphsHardAuto-graded
    Virus Spread Simulation with Recovery and Infection Thresholds

    Models discrete-time epidemic propagation on a grid where cells require multiple infected neighbors to catch the virus and recover after a fixed duration.

    Trees & Graphssimulationbfsgraph-traversal
  • Greedy & IntervalsMediumAuto-graded
    Venue Hours Checker with Overnight and Multi-Window Schedules

    Tests whether a venue is open at a given weekday and time, handling multiple daily windows, overnight shifts, and week-boundary wraparound.

    Greedy & Intervalsintervalssimulationboundary-conditions
  • Data Structure DesignEasyAuto-graded
    Sliding Window Hit Counter

    Tests ability to design time-windowed event counters with efficient memory management and query performance using sliding-window techniques.

    Data Structure Designqueuesliding-windowdata-structure-design
  • Heaps, Sorting & SearchMediumAuto-graded
    Binary Search Over a Row-Chained Sorted Grid

    Tests whether a candidate can exploit strict row-chaining in a sorted matrix to locate a target value in O(log(m·n)) time using a single binary search.

    Heaps, Sorting & Searchbinary-searcharraysmatrix
  • Trees & GraphsMediumModel answer
    Maze Exploration with Limited Sensor API

    Explore an unmapped grid using a restricted movement API to find a target location, tracking state through relative coordinates.

    Trees & Graphsgraph-traversaldfsstate-trackingbacktracking
  • Trees & GraphsMediumAuto-graded
    Count Connected Land Regions in a Binary Grid

    Tests iterative 2D graph traversal to count connected components of land cells without modifying the input or risking recursion stack overflow.

    Trees & Graphsgraph traversalBFS/DFSconnected componentsgrid
  • Dynamic ProgrammingMediumAuto-graded
    Split-or-Enumerate Symbol Sequence Decoder

    Tests string parsing, memoized backtracking, and combinatorial enumeration by decoding a symbol-encoded message with either explicit or missing letter boundaries.

    Dynamic Programmingstringsdynamic-programmingbacktracking
  • Arrays & HashingMediumAuto-graded
    Repair a Looping Script by Swapping One Instruction

    Tests simulation, cycle detection, and brute-force search by finding the single jmp/nop swap that lets a small virtual machine terminate cleanly.

    Arrays & Hashingsimulationcycle-detectionbrute-force
  • Data Structure DesignHardAuto-graded
    Multi-Consumer Iterator with Shared Buffering

    Tests iterator protocols, lazy evaluation, and memory-efficient buffering for multiple independent consumers reading from a single source stream.

    Data Structure Designiteratorsgeneratorsmemory-management
  • Trees & GraphsMediumModel answer
    Employee Hierarchy: Counting Trees, Level Traversal, and Ancestor Search

    Build a management structure from employee records, then count independent hierarchies, display staff by organizational depth, and locate shared supervisors.

    Trees & Graphstree-constructionlevel-order-traversallowest-common-ancestorgraph-fundamentals
  • Data Structure DesignMediumAuto-graded
    Batch Counter Updates with Global Shift and Min Extraction

    Tests lazy global offset propagation and min-heap with lazy deletion to efficiently manage counters under bulk increments and minimum extraction.

    Data Structure Designheaplazy-propagationdesign
  • Arrays & HashingEasyAuto-graded
    Classify Temperatures into Three Weather Bands

    Tests careful boundary handling by bucketing integer temperatures into cold, mild, and hot ranges and returning the three counts in order.

    Arrays & Hashingarrayscountingboundary conditions
  • Arrays & HashingMediumAuto-graded
    Rectangular Stamp Overlap Counter

    Tests whether a candidate can use a 2D difference array to efficiently count how many rectangular regions overlap each cell of a grid.

    Arrays & Hashing2d-arrayprefix-sumdifference-array
  • Math & Bit ManipulationMediumAuto-graded
    Calculate Day Count Between Two Dates

    Tests understanding of calendar arithmetic including leap year logic, month lengths, and converting dates to a numeric representation.

    Math & Bit Manipulationmathimplementationdate-arithmetic
  • Arrays & HashingEasyAuto-graded
    Find Days Available to All Participants

    Tests set intersection logic and handling of multiple collections to find common elements across all inputs.

    Arrays & Hashingsetsintersectionarrays
  • Data Structure DesignMediumAuto-graded
    Running Median Tracker with Dual-Heap Design

    Tests the ability to maintain an efficient two-heap structure that yields the current median of a growing integer stream in O(log n) per insertion and O(1) per query.

    Data Structure Designheaptwo-heapsdata-streammedian
  • Trees & GraphsHardAuto-graded
    Detect File Changes Using Content-Based Tree Hashing

    Tests hierarchical hashing, tree traversal, and efficient change detection across nested directory structures

    Trees & Graphshashingtree-traversaldiff-algorithms
  • Data Structure DesignMediumAuto-graded
    Simulate Least-Recently-Used Cache Operations

    Tests your ability to implement a data structure that maintains access order and performs lookups, updates, and evictions efficiently.

    Data Structure Designhash-maplinked-listcacheordered-dict
  • Trees & GraphsMediumAuto-graded
    Largest Land Mass After One Water-to-Land Conversion

    Tests grid connected-component labeling and the ability to optimally merge adjacent island regions by flipping a single water cell to land.

    Trees & Graphsgraphbfs-dfsconnected-componentsgrid
  • Trees & GraphsMediumAuto-graded
    Smallest Valid Sequence with Dependencies

    Tests topological sorting with lexicographic tie-breaking and cycle detection in a directed graph.

    Trees & Graphstopological-sortgraphheapcycle-detection
  • Trees & GraphsMediumModel answer
    Resolve Variable Assignments with Dependencies

    Parse assignment statements and compute a variable's value by recursively resolving dependencies, detecting cycles and undefined references.

    Trees & Graphsrecursiongraphsparsingdfs
  • Arrays & HashingMediumAuto-graded
    Puddles in a Valley: Water Volume Between Terrain Columns

    Tests whether a candidate can compute trapped water volume across a height profile using the two-pointer O(1)-space technique.

    Arrays & Hashingtwo-pointersprefix-maxarrays
  • Arrays & HashingHardAuto-graded
    Distinct Value Sum Across Peak-Score Square Ring Windows

    Tests 2D prefix sums, border enumeration, multi-way tie tracking, and cross-frame value deduplication on square ring-shaped windows of a matrix.

    Arrays & Hashing2d-prefix-summatrixsliding-window
  • Data Structure DesignMediumAuto-graded
    Contiguous Block Allocator with Tag-Based Memory Management

    Tests segment tree design for efficiently finding and tracking contiguous free blocks in a memory-like array with logarithmic-time allocation and release operations.

    Data Structure Designsegment-treeinterval-managementdata-structure-design
  • Data Structure DesignMediumAuto-graded
    Replay Operations on a Bounded LRU Cache

    Tests understanding of least-recently-used eviction by executing a sequence of cache operations and collecting their return values.

    Data Structure Designcachelruevictionsimulation
  • Arrays & HashingMediumAuto-graded
    Best Single-Breakpoint Step-Function Fit

    Tests whether a candidate can derive an O(n) prefix-aggregate sweep to find the one split index that minimizes total squared error for a two-segment constant model.

    Arrays & Hashingarraysmathprefix-sums