KatInterview

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

Coding Interview Problems

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

5972
Problems
2212
Auto-graded
15
Topics
273
Added today

Showing 2641–2670 of 2762 results

  • Data Structure DesignMediumAuto-graded
    Track Click-to-Conversion Matching with Time Windows

    Tests event stream processing with time-based lookback windows, requiring efficient per-user state management and timestamp-based expiration logic.

    Data Structure Designqueueshash-mapstime-windows
  • Data Structure DesignMediumModel answer
    Terminal Naval Combat: Fleet Setup and Attack System

    Implement a console-based naval battle game where two players configure their fleets through text input, then exchange fire until one side is eliminated.

    Data Structure Designobject-oriented-designinput-validationstate-management
  • Trees & GraphsMediumAuto-graded
    Detect a Cycle in a Directed Course Prerequisite Graph

    Tests whether you can model dependency constraints as a directed graph and use topological sort to detect cycles that make all tasks impossible to complete.

    Trees & Graphstopological-sortgraphcycle-detection
  • Trees & GraphsMediumModel answer
    Finding Profitable Exchange Cycles with Transaction Fees

    Given exchange rates between currencies and a per-cycle transaction cost, determine if any sequence of trades can yield a profit.

    Trees & Graphsgraph-algorithmsbellman-fordnegative-cyclelogarithms
  • StringsHardAuto-graded
    Greedy Token Substitution with Longest Prefix Matching

    Tests prefix-tree construction, greedy string scanning, and longest-match selection for token-based text transformation.

    Stringstriegreedystring-processing
  • Data Structure DesignMediumAuto-graded
    Transaction Fraud Pipeline with Behavioral Rules

    Build a stateful stream processor that validates payment records, detects velocity and spending anomalies, and produces fixed-width audit logs.

    Data Structure Designsimulationparsingsliding-window
  • Data Structure DesignHardAuto-graded
    Banking Ledger with Time-Based Transfers and Account Consolidation

    Build an in-memory banking system that processes timed fund transfers deterministically and consolidates accounts with automatic transaction rerouting.

    Data Structure Designunion-findsimulationsorting
  • Trees & GraphsHardAuto-graded
    Combine Tree Structures with Ordered Name Matching

    Tests recursive tree traversal with order-sensitive child pairing by name occurrence and careful handling of unmatched nodes.

    Trees & Graphsrecursiontree-traversalhash-table
  • Greedy & IntervalsMediumAuto-graded
    Find Available Time Slots in a Repeating Weekly Schedule

    Tests interval merging with time zones, weekly recurrence, and range filtering to find deployable windows on a cyclic timeline.

    Greedy & Intervalsintervalsarraystime-zones
  • Data Structure DesignMediumModel answer
    Word Matcher and File System Implementation

    Build a function to find whole-word keyword matches in text, then design an in-memory file system with directory and file operations.

    Data Structure Designstring-processingdata-structurestreedesign
  • Heaps, Sorting & SearchMediumModel answer
    Merge Sorted Runs by Absolute Value and Extract k-th Element

    Reorder a sorted array by absolute value in linear time, then find the k-th element in that order using logarithmic-time search without materializing the full result.

    Heaps, Sorting & Searchbinary-searchtwo-pointersorder-statisticsarray-manipulation
  • Dynamic ProgrammingMediumAuto-graded
    Minimum Cost to Transform One String into Another

    Tests string DP by computing the minimum total cost to convert a source string into a target string using per-character insert, delete, and replace operations with custom costs.

    Dynamic Programmingdynamic programmingstringedit distance
  • Data Structure DesignHardModel answer
    Arrays vs Hash Maps: Trade-offs for Sparse Active-Record Stores

    Compare arrays and hash maps across time complexity, memory, and cache behavior, then choose the right structure for a sparse integer-keyed active set.

    Data Structure Designhash-maparraymemorycache
  • Data Structure DesignMediumModel answer
    Concurrent Cache with Deduplication and Safe Expiry

    Implement thread-safe cache retrieval that deduplicates simultaneous requests for identical keys while maintaining parallelism across distinct keys.

    Data Structure Designconcurrencycachingsynchronization
  • Linked ListsHardAuto-graded
    Interleave Linked List Halves by Node Values

    Tests pointer-manipulation intuition by reordering a linked list (given as an array) into a specific interleaved pattern derived from splitting and reversing halves.

    Linked Listslinked listsarray manipulationtwo pointers
  • Data Structure DesignMediumModel answer
    Frontend State Management and Form Handling

    Build a web interface that manages list state, handles form submission with proper error recovery, integrates with APIs, and maintains data consistency.

    Data Structure Designfrontendstate-managementform-validationapi-integration
  • Math & Bit ManipulationMediumAuto-graded
    Count Lattice Paths Through Required Checkpoints

    Tests whether a candidate can combine combinatorics (binomial coefficients) to count grid paths that must pass through a sequence of ordered checkpoints.

    Math & Bit Manipulationcombinatoricsmathdynamic programming
  • Data Structure DesignMediumAuto-graded
    Flip Isolated O Regions to X Using Union-Find

    Implement a union-find solution to identify and capture O regions that don't reach the board's edges, testing disjoint-set design and 2D-to-1D index mapping.

    Data Structure Designunion-finddisjoint-setgridconnectivity
  • Greedy & IntervalsMediumAuto-graded
    Consolidate Half-Open Interval Ranges

    Tests interval merging with half-open semantics, distinguishing overlap from adjacency, and handling nested ranges correctly.

    Greedy & Intervalsintervalssortinggreedyarray-manipulation
  • Greedy & IntervalsHardAuto-graded
    Minimum Guards to Cover All Museum Gallery Segments

    Tests ability to apply a sweep-line with a greedy exchange argument to optimally place point guards that each cover a fixed-radius interval on a 1-D gallery.

    Greedy & Intervalsgreedyintervalssweep line
  • Dynamic ProgrammingMediumAuto-graded
    Minimum Tokens to Reach a Score: Reusable vs. One-Time Use

    Tests whether a candidate can implement both unbounded and 0/1 knapsack DP to find the smallest number of tokens that sum exactly to a target.

    Dynamic Programmingdynamic-programmingknapsackbottom-up-dp
  • Stacks & QueuesMediumAuto-graded
    Minimum Length Subarray with Sum Threshold

    Tests the ability to optimize subarray sum queries using prefix sums and monotonic deque when values can be negative.

    Stacks & Queuesprefix-sumsmonotonic-dequesliding-windowarray
  • Data Structure DesignMediumAuto-graded
    Aggregate Scores Across a Sponsorship Tree

    Tests tree traversal and subtree aggregation by computing cumulative scores bottom-up across a forest of sponsor-recruit relationships.

    Data Structure Designtrees-graphsdesign-dsstacks-queues
  • Greedy & IntervalsMediumAuto-graded
    Assign Tasks to Time Slots with Minimum Idle Penalty

    Tests the exchange-argument greedy technique by scheduling deadline-bearing tasks into time slots to minimize total weighted idle (missed-deadline) penalty.

    Greedy & Intervalsgreedyintervalsschedulingexchange argument
  • Arrays & HashingEasyAuto-graded
    Complete the Run: Find the Gap in a Five-Card Sequence

    Tests ability to handle encoded card ranks, Ace-as-low/high semantics, ambiguous endpoints, and missing-element logic in a fixed consecutive sequence.

    Arrays & Hashingarraysstringsenumeration
  • Trees & GraphsMediumAuto-graded
    Connected Land Regions in a Character Matrix

    Tests graph traversal and connected-component identification on a 2D grid using flood-fill techniques.

    Trees & Graphsgraph-traversaldfsconnected-componentsgrid
  • Dynamic ProgrammingEasyAuto-graded
    Count Paths Through a Grid with Blocked Cells

    Tests whether a candidate can apply bottom-up DP on a 2-D grid to count reachable paths from top-left to bottom-right while respecting blocked cells.

    Dynamic Programmingdynamic programminggridpaths
  • StringsMediumAuto-graded
    Decode a Run-Length Encoded String With Nested Groups

    Tests the ability to parse and expand a run-length encoded string that contains arbitrarily nested bracket groups, combining stack-based parsing with string manipulation.

    Stringsstringsparsingstackrun-length encoding
  • Trees & GraphsMediumAuto-graded
    Detect Circular Dependencies in a Build System

    Tests cycle detection in a directed graph by determining which packages in a build dependency graph are part of a circular dependency chain.

    Trees & Graphsgraphscycle detectionDFStopological sort
  • Stacks & QueuesEasyAuto-graded
    Evaluate Simple Arithmetic String Expressions

    Tests ability to evaluate a string expression containing non-negative integers, +, -, *, / operators, and parentheses using a stack-based approach.

    Stacks & Queuesstacksexpression evaluationparsing