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 2191–2220 of 2776 results

  • Stacks & QueuesHardAuto-graded
    Peak Tower Configuration with Height Limits

    Construct a sequence that rises then falls while respecting per-element caps, maximizing the sum using greedy peak selection and monotonic stacks.

    Stacks & Queuesmonotonic-stackgreedyprefix-sum
  • Trees & GraphsMediumAuto-graded
    Detect Cycles in a Package Dependency Graph

    Tests ability to detect cycles in a directed graph using DFS-based cycle detection, modelling package dependencies where a cycle makes installation impossible.

    Trees & Graphsgraphscycle detectiondepth-first searchtopological order
  • Dynamic ProgrammingMediumAuto-graded
    Count Tile-Filling Combinations for a Target Length

    Tests unbounded-knapsack DP by counting unordered multisets of tile widths, drawn from a given list, that sum exactly to a target corridor length.

    Dynamic Programmingdynamic-programmingcombinatoricsunbounded-knapsack
  • Arrays & HashingMediumAuto-graded
    Seven-Segment Display 180° Rotation Symmetry

    Determine if a sequence of seven-segment digits appears identical when the entire display is flipped upside down.

    Arrays & Hashingarrayssimulationmapping
  • Heaps, Sorting & SearchMediumAuto-graded
    Kth Element in Union of Two Sorted Lists

    Tests ability to find the kth smallest element from two sorted arrays using binary search on partition counts rather than merging.

    Heaps, Sorting & Searchbinary-searcharraystwo-pointers
  • Math & Bit ManipulationMediumAuto-graded
    Observer Simulation and Manual Integer Conversion

    Tests event-driven simulation optimization and precise numeric string formatting including signed 32-bit boundary handling.

    Math & Bit Manipulationsimulationmathstring-manipulation
  • Arrays & HashingMediumAuto-graded
    Group and Rank Users by Average Value

    Tests efficient grouping and aggregation over dictionaries, plus multi-key sorting to produce ordered output.

    Arrays & Hashingaggregationdictionariessorting
  • Arrays & HashingEasyAuto-graded
    Filter and Sort Items by Embedding Similarity Score

    Tests vector scoring with dot products, stable sorting with tie-breaking, and set-based filtering of excluded indices.

    Arrays & Hashingarrayssortingfiltering
  • Arrays & HashingMediumAuto-graded
    Suffix Maximum Frequency Count

    Computes how many times the largest element appears in each suffix of an array using a single backward scan.

    Arrays & Hashingarrayssuffix-queriessingle-pass
  • Trees & GraphsHardAuto-graded
    Reduce Worst-Case Coverage Gap with One New Relay Node

    Tests binary search on answer combined with multi-source BFS and 2D prefix sums to optimally place one relay node and minimize the maximum Chebyshev coverage distance.

    Trees & Graphsbinary-searchbfsmatrixprefix-sums
  • Linked ListsMediumAuto-graded
    Interleave Two Linked Lists by Position Parity

    Tests pointer manipulation and node reordering by splitting a singly linked list (given as an array) into odd- and even-indexed sublists and merging them in a specific interleaved pattern.

    Linked Listslinked listspointer manipulationreorderingarray simulation
  • Data Structure DesignMediumAuto-graded
    Simulate a Nested Tic-Tac-Toe Game with Board-Routing Rules

    Tests state management for a two-layer game board with recursive win detection and dynamic move constraints based on previous plays.

    Data Structure Designsimulationgame-theorystate-machine
  • Data Structure DesignMediumAuto-graded
    Duplicate Linked List and Simulate LRU Cache Operations

    Tests linked list deep copying with arbitrary pointers and implementing an LRU cache with O(1) operations using hash maps and doubly-linked lists.

    Data Structure Designlinked-listshash-mapdesignpointers
  • Stacks & QueuesMediumModel answer
    Stack Trace Event Stream from Periodic Samples

    Convert a sequence of call stack snapshots into function entry and exit events with configurable debouncing to filter transient frames.

    Stacks & Queuesstacksarrayssimulationstate-machine
  • StringsMediumModel answer
    Five Python Fundamentals: Iteration, Collections, and Edge Cases

    Write five short functions covering string repetition, list transformation, FizzBuzz, word counting, and finding the second-largest unique integer.

    Stringspythonfundamentalsedge-cases
  • Arrays & HashingEasyAuto-graded
    Rank Nearest Neighbors by Mean Squared Error

    Tests k-nearest neighbors search with distance computation, NULL handling, and top-k selection with tie-breaking.

    Arrays & Hashingsimilaritydistance-metricsrankingdata-processing
  • Data Structure DesignHardModel answer
    In-Memory Transaction Ledger with Aliases and History

    Implement a timestamped in-memory ledger supporting deposits, cashback transfers, scheduled execution, account merging with alias resolution, and point-in-time balance queries.

    Data Structure Designunion-findheapbinary-searchsimulation
  • Data Structure DesignMediumModel answer
    Constant-Time Range Queries and Stack with Maximum Tracking

    Implement two data structures: one supporting fast interval sum queries on a fixed array, and a stack that efficiently tracks and removes its maximum element.

    Data Structure Designprefix-sumstackheapdata-structures
  • Data Structure DesignEasyAuto-graded
    Simulate a Bounded LRU Cache with Get/Put Operations

    Tests the ability to simulate a fixed-capacity LRU cache by processing a sequence of get/put operations and collecting all get results in order.

    Data Structure Designdata structurescachesimulation
  • Data Structure DesignMediumModel answer
    Maintaining a Random Sample from a Stream of Unknown Length

    Implement a data structure that keeps k randomly chosen items from a stream where you don't know the total count ahead of time.

    Data Structure Designreservoir-samplingstreaming-algorithmsrandomized-algorithms
  • Trees & GraphsMediumAuto-graded
    Axis-Aligned Bounding Boxes of Grid Regions

    Tests BFS/DFS connected-components traversal on a 2D grid to locate distinct filled regions and compute the tightest enclosing rectangle for each.

    Trees & Graphsbfsdfsconnected-componentsgrid
  • Arrays & HashingMediumModel answer
    Proportional Stratified Sampling with Largest Remainder Allocation

    Sample records from grouped data while preserving stratum proportions, using the largest remainder method to allocate exact counts and seeded random selection.

    Arrays & Hashingsamplinggroupinghash-tablerandomization
  • Trees & GraphsMediumAuto-graded
    Shortest Path Through a Grid With Keys and One-Way Portals

    Tests BFS/Dijkstra on an augmented state space where position must be combined with a key-collection bitmask, and directional arrow tiles enforce constrained traversal.

    Trees & Graphsbfsdijkstrabitmaskgrid
  • Heaps, Sorting & SearchHardAuto-graded
    Select Best Available Venues by Ranking Criteria

    Tests filtering, multi-level sorting with custom tie-breaking rules, and efficient top-K selection from structured data.

    Heaps, Sorting & Searchsortingfilteringheappriority-queue
  • Data Structure DesignMediumAuto-graded
    Key-Value Store Operation Simulator

    Tests ability to use hash maps for constant-time operations and handle state transitions in a key-value store simulation.

    Data Structure Designhash-mapsimulationdata-structures
  • Heaps, Sorting & SearchEasyAuto-graded
    Combine Multiple Sorted Lists into a Single Sorted Sequence

    Tests divide-and-conquer merging and two-pointer techniques to efficiently combine many pre-sorted lists.

    Heaps, Sorting & Searchdivide-and-conquertwo-pointersmerging
  • Trees & GraphsMediumModel answer
    Robot Grid Exploration with Limited Sensing API

    Navigate a robot through an unmapped grid with obstacles using only movement and turn commands to locate a target cell.

    Trees & Graphsdfsbacktrackinggraph-traversalsimulation
  • Trees & GraphsHardModel answer
    Shortest Path for a Hobbled Xiangqi Horse on a 10×9 Board

    Find the minimum moves for a Chinese-chess horse to reach a target on a 10×9 grid, accounting for the leg-blocking movement restriction and obstacle squares.

    Trees & GraphsBFSgraph traversalboard gamesshortest path
  • Greedy & IntervalsMediumAuto-graded
    Single Buy-Sell Stock Gain

    Tests finding the maximum profit from one purchase and one sale in a price sequence using a single-pass greedy approach.

    Greedy & Intervalsgreedyarrayssliding-window
  • Data Structure DesignMediumAuto-graded
    Historical Key-Value Store with Time-Based Retrieval

    Tests your ability to build a versioned data store supporting efficient historical lookups through binary search on sorted timestamps.

    Data Structure Designbinary-searchhash-mapdata-structures