KatInterview

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

Coding Interview Problems

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

5981
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 421–450 of 650 results

  • Data Structure DesignMediumModel answer
    Design a Multiset Trie with Fast Prefix Counting

    Build a trie that tracks word multiplicities, supports insertion, deletion, exact and prefix lookup, and handles Unicode safely.

    Data Structure Designtriedata-structuresconcurrencyunicode
  • Dynamic ProgrammingMediumModel answer
    Digit-Sum Frequency Peaks

    Count how many digit-sum values tie for the most occurrences among integers 1 through n.

    Dynamic Programmingdigit-dpcombinatoricsmath
  • Data Structure DesignMediumModel answer
    Build a Nested-Transaction Key–Value Store from Scratch

    Design and implement an in-memory key–value store that supports arbitrarily nested BEGIN/COMMIT/ROLLBACK transactions with correct shadowing and O(1) reads.

    Data Structure Designhash-mapstacktransactionsundo-log
  • Arrays & HashingMediumModel answer
    Writing Test Cases for Array and String Problems

    Design a systematic testing strategy for array and string coding problems, covering edge cases, validation, and stress testing.

    Arrays & Hashingtestingedge-casesdebugging
  • Data Structure DesignMediumModel answer
    Build a Stack That Also Tracks and Removes the Maximum

    Design a stack supporting push, pop, top, peekMax, and popMax, with two implementations trading off simplicity against O(log n) worst-case popMax.

    Data Structure Designstackheaplinked-listamortized-complexity
  • StringsMediumModel answer
    Aggregate HTTP Logs to Identify Top Client Addresses

    Parse multi-file request logs to extract and rank the five IPv4 addresses that generated the most completed HTTP requests.

    Stringsparsingregexaggregationtop-k
  • Data Structure DesignHardModel answer
    Versioned In-Memory Set with Snapshot Iterators and WAL Contracts

    Design an MVCC-backed mutable set with O(1) snapshot iterators and specify the durability, ordering, and crash-recovery contracts for a write-ahead log.

    Data Structure DesignMVCCsnapshot isolationWALdata structure design
  • Greedy & IntervalsMediumModel answer
    Assign Support Tickets to Agents Within Concurrency Limits

    Given a list of fixed-time support tickets, assign each to an agent while respecting per-client concurrency caps and an optional agent pool size.

    Greedy & Intervalsgreedyinterval-schedulingheapsweep-line
  • Arrays & HashingHardModel answer
    Fewest Swaps to Bring an Array with Duplicates into Sorted Order

    Given an integer array that may contain duplicates, find the minimum number of arbitrary index swaps needed to sort it in non-decreasing order.

    Arrays & Hashingsortingpermutationscycle-detectiongreedy
  • Math & Bit ManipulationMediumModel answer
    Bounded Robot Path Under Infinite Command Repeats

    Simulate one pass of a compressed command string, then decide whether infinitely repeating it keeps the robot inside a finite region, even with obstacles.

    Math & Bit Manipulationsimulationcycle-detectiongeometrystate-machine
  • Arrays & HashingMediumModel answer
    Peak Average Score: Overflow, Large Files, and Java Concurrency

    Aggregate student scores to find the highest per-student average, then extend the solution for huge files, negative values, integer overflow, and multithreaded processing.

    Arrays & Hashingjavaconcurrencyaggregationinteger-overflow
  • Trees & GraphsHardModel answer
    Check Whether a Node Sequence Is a Valid BFS on a Tree

    Given an undirected tree and multiple permutations of its nodes, determine for each permutation whether it could be the dequeue order of some BFS starting at its first element.

    Trees & GraphsBFStreessimulationhashing
  • Data Structure DesignHardModel answer
    Mutable Integer Set with Freeze-Frame Iterators

    Design an integer set supporting O(1) add/remove/contains plus snapshot iterators that capture insertion-order state at creation time without copying.

    Data Structure Designsnapshotsiteratorsappend-only logversioning
  • Data Structure DesignMediumModel answer
    Build a Path-Addressed Tree Store and a Bounded Ring Buffer

    Design an in-memory hierarchical path store with strict parent-existence errors, plus a fixed-capacity FIFO queue where every operation is constant time.

    Data Structure Designtriehash-mapcircular-bufferapi-design
  • Arrays & HashingMediumModel answer
    Simulating Motion Under Time-Varying Visibility Constraints

    Determine how many entities moving rightward on a line reach a target position when their movement is blocked by a direction-switching observer.

    Arrays & Hashingsimulationbinary-searchprefix-sum
  • Trees & GraphsMediumModel answer
    Height-Balanced Nodes in Heap-Array Trees

    Traverse a binary tree stored in heap-index layout to find every node whose subtree is height-balanced, returning each with its tree level.

    Trees & Graphsbinary-treepost-orderheap-layoutbottom-up
  • Greedy & IntervalsMediumModel answer
    Minimum Shift Count for Concurrent Task Scheduling

    Given tasks with time windows and resource demands, find the fewest parallel workers needed so no worker exceeds capacity K at any moment.

    Greedy & Intervalsgreedyintervalsheapbin-packing
  • Data Structure DesignMediumModel answer
    In-Memory Grid with Formula Evaluation and Cycle Guards

    Build a spreadsheet class in three stages: plain integer cells, formula parsing with dependency-order evaluation, then cycle detection and targeted recomputation.

    Data Structure Designgraphsdependency-trackingparsing
  • Data Structure DesignHardModel answer
    Peak Concurrent Couriers Over a Rolling 24-Hour Window

    Design a data structure that records courier delivery intervals and efficiently answers: what is the highest number of couriers simultaneously active at any instant in the last 24 hours?

    Data Structure Designsegment-treeintervalssliding-windowonline-algorithms
  • Data Structure DesignHardModel answer
    Building Map and Filter from a Reduce Foundation

    Implement a reduce operation, then express map and filter purely in terms of that reducer without independent iteration.

    Data Structure Designhigher-order-functionsfunctional-programmingdata-structures
  • Data Structure DesignMediumModel answer
    Build a Dropping Tile Game with Win Detection

    Implement game logic for a gravity-based two-player board game: handle piece placement, detect wins efficiently, and analyze complexity.

    Data Structure Designgame-logic2d-gridstate-machine
  • Data Structure DesignMediumModel answer
    Build a Type-Aware Key-Value Store from First Principles

    Design a hash map that supports keys and values of arbitrary types, covering hashing contracts, equality semantics, collision resolution, and memory ownership.

    Data Structure Designhash-maptype-erasurecollision-resolutionmemory-management
  • StringsMediumModel answer
    CSV Transaction Parser with Validation and Error Handling

    Design a pipeline that parses CSV transaction records, normalizes fields, validates data integrity, and segregates malformed entries.

    Stringsdata-validationparsingerror-handling
  • Arrays & HashingMediumModel answer
    Longest Streak of Distinct Viewing History

    Find the longest contiguous subsequence in a viewing history array where no show appears more than once (case-insensitive).

    Arrays & Hashingsliding-windowhash-maptwo-pointers
  • Trees & GraphsMediumModel answer
    Nearest Depot and Peak-Load Routing on a Grid

    Given a grid with depot cells, find shortest paths from query locations to any depot, then extend to pick the depot maximizing a distance-penalized load score.

    Trees & GraphsBFSDijkstramulti-sourcegrid
  • Data Structure DesignMediumModel answer
    Generate Unique Character Profiles with Attribute Rules

    Build a generator that creates N character profiles from trait pools, enforcing no-duplicates, uniqueness, and dependency rules between attributes.

    Data Structure Designbacktrackingconstraint-satisfactionalgorithms
  • Dynamic ProgrammingHardModel answer
    DAG Schedule Analysis and Windowed Checkpoint DP

    Compute critical-path latency and peak concurrency for a task DAG, then find minimum-cost checkpoint placement under a sliding-window coverage constraint.

    Dynamic Programmingdagtopological-sortsliding-windowdynamic-programming
  • Stacks & QueuesMediumModel answer
    Maximize Throughput in a Serial Manufacturing Pipeline

    Design and simulate a fixed-time serial pipeline to maximize completed units, given per-stage processing times, inter-stage buffer capacities, and blocking-after-service rules.

    Stacks & Queuessimulationschedulingqueuesthroughput
  • Greedy & IntervalsMediumModel answer
    Merge Active Intervals from Multiple Time-Series Sensors

    Parse sensor streams into continuous activity windows and find time ranges where all sensors are simultaneously active.

    Greedy & Intervalsintervalstime-seriesintersectiontwo-pointers
  • Data Structure DesignMediumModel answer
    Build a Collapsible JSON Tree Renderer in React

    Create a React component that parses a JSON string and displays it as an interactive, expandable tree structure.

    Data Structure Designreactrecursioncomponent-designstate-management