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 481–510 of 2121 results

  • Data Structure DesignEasyAuto-graded
    Design a Deduplicated Storage System

    Simulate file system operations while maintaining deduplicated content storage using reference counting.

    Data Structure Designdesign-dsarraysstrings
  • Trees & GraphsMediumAuto-graded
    Maximum Pebble Removals on a Coordinate Board

    Compute how many pebbles can be taken off a board when each removal needs another remaining pebble in the same row or column, using connected components.

    Trees & Graphsunion-findconnected-componentsgraph-modelingdfs
  • Arrays & HashingMediumAuto-graded
    Rank Documents by Query Relevance with Smoothed TF-IDF

    Tests hashing and counting over text: tokenize, compute smoothed IDF for query terms, score every document, and sort by descending score with an index tie-break.

    Arrays & Hashinghashingtf-idftokenizationsorting
  • Math & Bit ManipulationEasyAuto-graded
    Matrix Power and Empirical Transitions for a Markov Chain

    Raise a row-stochastic matrix to a given power and build a row-normalized transition estimate from observed index pairs, leaving rows with no data as zeros.

    Math & Bit Manipulationmatrix-exponentiationmarkov-chainprobabilitycounting
  • Math & Bit ManipulationMediumAuto-graded
    Scale Factor-Model Portfolio Risk to a Yearly Figure

    Compute a portfolio's one-period variance from a factor model (exposures, factor covariance, specific variances), then scale it by periods per year and take the square root.

    Math & Bit Manipulationmatrixlinear-algebrafinancequadratic-form
  • Arrays & HashingEasyAuto-graded
    Execute In-Memory Key-Value Storage Commands

    Simulate an in-memory key-value dictionary given a sequence of insertion, lookup, and deletion instructions.

    Arrays & Hashingarrayshash-mapdata-structuresdesign
  • StringsMediumAuto-graded
    Reconstruct IPv4 Addresses from Digit Sequence

    Parse a string of numeric digits into all possible valid four-part IPv4 address representations.

    Stringsstringsbacktrackingparsing
  • Arrays & HashingMediumAuto-graded
    Stream Token Lists into Fixed-Size Blocks with a Validity Mask

    Concatenate truncated token lists into equal-length blocks, zero-pad the last one, and build a parallel 0/1 mask marking real tokens versus padding.

    Arrays & Hashingarrayssimulationtwo-pointersbatching
  • Heaps, Sorting & SearchMediumAuto-graded
    Maximize Uniform Cut Length for Target Segment Count

    Find the maximum integer segment length that can produce at least a specified count of equal-sized pieces using binary search on answer.

    Heaps, Sorting & Searchbinary-searcharraysgreedy
  • Arrays & HashingMediumAuto-graded
    Bucket Words by Letter Multiset Without Per-Word Sorting

    Cluster words that share identical letter counts into ordered buckets, using a hashable frequency key rather than sorting each word's letters, while preserving duplicates and order.

    Arrays & Hashinghash-mapstringsanagramsfrequency-count
  • Data Structure DesignMediumAuto-graded
    Run-of-K Grid Game Simulator for Many Players

    Simulate an N x N, M-player connect-K game with turn order, move validation, win detection from the last move, board snapshots and undo.

    Data Structure Designsimulationgriddesignundo
  • Trees & GraphsMediumAuto-graded
    Longest Chain of Accounts Reachable Through Follows

    Find the longest simple path from a start node in a directed graph with possible cycles, using backtracking DFS with a per-path visited set.

    Trees & Graphsgraphdfsrecursionbacktracking
  • Arrays & HashingEasyAuto-graded
    Monthly Hit Tracks: Overall and Per-Region Leaderboards

    Filter streaming events by duration and date window, count plays per track, and produce a global top 5 and per-country top 3 with deterministic tie-breaking.

    Arrays & Hashinghash-mapcountingsortinggrouping
  • StringsMediumAuto-graded
    Compressed Word Check Plus Bracket Matching

    Tests two linear scans in one function: validating a numeric-skip word abbreviation with two pointers, and checking nested bracket balance with a stack.

    Stringstwo-pointersstackstring-parsingvalidation
  • Arrays & HashingEasyAuto-graded
    Keep Only First Appearances in an Integer List

    Tests using a hash set alongside a list to filter repeated integers in one pass while preserving first-appearance order, in linear time.

    Arrays & Hashinghash-setarraysdeduplicationorder-preservation
  • Data Structure DesignMediumAuto-graded
    Roster Coverage and Rating Leaderboard Simulator

    Simulate a command log against a stateful tracker that merges per-agent time intervals and ranks agents by average rating with alphabetical tie-breaking.

    Data Structure Designdesignintervalshash-mapsorting
  • Arrays & HashingMediumAuto-graded
    Users With a Qualifying Login Session in an Unordered Event Log

    Pair sign-in and sign-out events per user from an unsorted log using chronological order and FIFO matching, and report users with a session within a time limit.

    Arrays & Hashinghash-mapsortingqueuesimulation
  • Trees & GraphsMediumAuto-graded
    Five-Task Toolkit: Graphs, Swaps, Digits, Cache, Trees

    Solve five small tasks in one call: count graph components, minimum swaps to sort, largest monotonic number, simulate an LRU cache, and compare two N-ary trees.

    Trees & Graphsgraph-traversalcycle-decompositiongreedy-digitslru-cache
  • Arrays & HashingMediumAuto-graded
    Seeded Two-Round K-Means with Spread-Out Starting Centers

    Simulate k-means++ seeding with a fixed RNG protocol, then run two assign/update rounds and report clusters, centroids and final squared error.

    Arrays & Hashingsimulationclusteringrandomized-samplingfloating-point
  • Stacks & QueuesMediumAuto-graded
    Resolve Field Paths in a Nested Message Schema

    Parse brace-delimited nested message definitions line by line, then check which dotted query paths name an actual field, tracking scope with a stack.

    Stacks & Queuesparsingstackhash-setstrings
  • Trees & GraphsMediumAuto-graded
    Tally Separate Clusters of Ones in a Binary Matrix

    Count 4-directionally connected clusters of 1s in a binary matrix using graph traversal, with care for visited tracking, empty inputs, and deep clusters.

    Trees & Graphsdfsgridconnected-componentsmatrix
  • Data Structure DesignMediumAuto-graded
    Batch-Driven Slash-Path Registry with Leaf-Only Deletion

    Simulate a tree-shaped registry addressed by slash-separated paths, processing a batch of create, set, get and remove commands and returning one result per command.

    Data Structure Designtriehash-mapdesignstring-parsing
  • Trees & GraphsHardAuto-graded
    Shortest Looping Command Script for a Fuel-Limited Rover

    Brute-force enumerate looping command scripts of length 1 to 10 and simulate each on a grid with fuel, walls and refuel pads, using state-repeat detection to stop loops.

    Trees & Graphssimulationbrute-forcegridcycle-detection
  • Dynamic ProgrammingHardAuto-graded
    Daily Vendor Booking with No Immediate Repeats

    Choose one vendor per day to minimize total price with no vendor on consecutive days, returning the plan with a fixed tie-break; tests DP, backtracking, and best/second-best.

    Dynamic Programmingdynamic-programmingpath-reconstructionoptimizationarrays
  • Arrays & HashingMediumAuto-graded
    Longest Run of Non-Repeating Numbers in an Array

    Find the length of the longest contiguous stretch of an integer array in which no value appears twice, using a sliding window with a last-seen index map.

    Arrays & Hashingsliding-windowhash-maptwo-pointerssubarray
  • Math & Bit ManipulationMediumAuto-graded
    Working Days Between Two Dates with a Closure List

    Count Monday-to-Friday days in an inclusive date range, skipping listed closure dates, using week arithmetic instead of day-by-day iteration.

    Math & Bit Manipulationdatescalendararithmeticsets
  • Heaps, Sorting & SearchEasyAuto-graded
    Minimum Postponed Debits to Avoid Negative Balance

    Find the minimum number of negative transactions to postpone so that the running account balance remains non-negative throughout processing.

    Heaps, Sorting & Searchheaps-sortinggreedy-intervalsarrays
  • Math & Bit ManipulationMediumAuto-graded
    Smallest Primes Prefix: Build the First n Primes

    Generate the first n primes in ascending order, which tests sieve design with an upper bound derived from a count, plus handling of non-positive n.

    Math & Bit Manipulationprimessievenumber-theorymath
  • Greedy & IntervalsEasyAuto-graded
    Filter Financial Logs by Active Premium Periods

    Filter a chronological sequence of transaction records based on whether they fall within active premium membership intervals.

    Greedy & Intervalsintervalsdata-filteringhash-table
  • Data Structure DesignMediumAuto-graded
    Append-Only Editor with Undo and Redo Replay

    Simulate a tail-only text buffer with undo and redo histories, recording only edits that change the text and clearing redo on every new edit.

    Data Structure Designdesignstacksimulationundo-redo