KatInterview

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

Coding Interview Problems

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

6035
Problems
2235
Auto-graded
15
Topics
274
Added today

Showing 1111–1140 of 2788 results

  • Data Structure DesignMediumModel answer
    Dynamic Anagram Collection Tracker with Group Size Optimization

    Design a class to insert, remove, and query the largest group of anagram words in real time, exploring performance trade-offs for read and write loads.

    Data Structure Designdesign-dsstringsarrays
  • Data Structure DesignMediumAuto-graded
    Quota-Limited Storage Simulator with Staging and Snapshots

    Simulate a per-user file store with staged uploads, quota checks, ranked prefix queries, and atomic snapshot restores under two conflict policies.

    Data Structure Designdesignhash-mapsimulationsorting
  • Arrays & HashingMediumModel answer
    Modern Java 8 Toolkit: Lambdas, Streams, Optional, java.time

    Explain the major Java 8 language and library additions, when each one fits, and the common pitfalls, using short code examples.

    Arrays & Hashingjavajava-8lambdasstreams
  • Trees & GraphsMediumAuto-graded
    Grid Land Mass Valuation

    Find all orthogonal connected components of non-zero cells in a 2D grid and calculate the total sum of cell values for each component.

    Trees & Graphstrees-graphsbreadth-first-searchdepth-first-searchmatrix
  • Arrays & HashingEasyAuto-graded
    Simulate Slice Appending in Go

    Simulate how slicing and slice appending mutate backing arrays and slice headers in Go.

    Arrays & Hashingarrayssimulation
  • Data Structure DesignMediumAuto-graded
    Sliding-Window Leaderboard Replay Simulator

    Simulate a class that logs timestamped events and reports the K most frequent IDs in a closed time window, with out-of-order events and queries.

    Data Structure Designdesignbinary-searchhash-mapsorting
  • Trees & GraphsMediumAuto-graded
    Sum of Keys Within a Value Window in a Serialized BST

    Rebuild a BST from a level-order list and sum the node values inside an inclusive range, using ordering to skip subtrees that cannot contain qualifying values.

    Trees & Graphsbinary-search-treedfstree-constructionpruning
  • Data Structure DesignMediumAuto-graded
    Versioned Network Edge Tracker

    Process a stream of edge insertions, snapshot triggers, and historical adjacency queries for a dynamic graph.

    Data Structure Designdesign-dsarraystrees-graphs
  • Heaps, Sorting & SearchMediumAuto-graded
    Lowest-Numbered Free Room Booking for Time Slots

    Simulate a deterministic room-allocation process with heaps: sort by start, free finished rooms, pick the smallest free ID, and report assignments in input order.

    Heaps, Sorting & Searchheapsimulationsortingintervals
  • Dynamic ProgrammingHardModel answer
    Best Self-Matching Count After Removing Array Elements

    Delete any elements from an array so the most remaining values equal their new 1-based position. Reduce it to a longest-chain problem solved in O(n log n).

    Dynamic Programmingdynamic-programminglongest-increasing-subsequencebinary-searchsubsequence
  • Data Structure DesignHardAuto-graded
    Design a Custom Key-Value Map

    Execute a series of map operations (put, get, remove) by simulating a hash map without using built-in dictionaries or sets.

    Data Structure Designarraysdesign-dshash-table
  • Data Structure DesignEasyAuto-graded
    Rolling Ten-Minute Error Counter by Endpoint Prefix

    Replay a log of error-recording and alert-check operations, grouping errors by URL prefix and counting those in an inclusive 600-second window against a strict threshold.

    Data Structure Designdesignbinary-searchhash-mapsliding-window
  • Dynamic ProgrammingMediumModel answer
    Autonomous Drone Navigation in Dynamic Canyons

    Design a deterministic per-tick controller for a thruster-driven drone navigating procedurally generated obstacle canyons using lookahead simulation.

    Dynamic Programmingdynamic-programminglookahead-searchsimulationmemoization
  • Heaps, Sorting & SearchMediumAuto-graded
    Where Is Everyone? Locating Travelers at a Given Instant

    Group unsorted flight records by traveler and decide each traveler's status at a query timestamp, using half-open flight intervals.

    Heaps, Sorting & Searchsortinghash-mapintervalstimestamps
  • Arrays & HashingEasyAuto-graded
    Target Token Loss and Exponential Uncertainty Score

    Compute the mean negative log-likelihood across target tokens and convert it into perplexity for a given logarithm base.

    Arrays & Hashingmachine-learningmathnlp
  • Data Structure DesignHardModel answer
    Design a Time-Series Cloud Credit Ledger

    Design an in-memory cloud billing system supporting delayed cashback rebates, account consolidation, point-in-time historical balance queries, and spend leaderboards.

    Data Structure DesignData Structure DesignHeapUnion FindBinary Search
  • Data Structure DesignMediumModel answer
    Build a Data-Fetching React Hook and Wire Up a Dashboard UI

    Write a React hook that fetches and reshapes API data with loading, error and refetch support, then connect a modal, a collapsible list and action buttons to component state.

    Data Structure DesignreacthooksuseEffectasync
  • Data Structure DesignMediumAuto-graded
    Typo-Tolerant Word Lookup with One Edit

    Answer batches of lookups against a fixed word list, returning every word within Levenshtein distance 1 of the query, using a deletion-based hash index.

    Data Structure Designhash-mapedit-distancestringsindexing
  • Trees & GraphsHardModel answer
    Tree to String and Back: A Lossless Binary Tree Codec

    Build a pair of functions that flatten a binary tree of integers into a string and restore the identical tree from that string, with a clear format and a correctness argument.

    Trees & Graphsbinary-treeserializationpreorderstack
  • Trees & GraphsHardAuto-graded
    Climbing Routes From the Corner: Batch Lookup of Shortest Paths

    Run one BFS from the top-left cell of a grid with distinct values, using strictly increasing moves, then answer many target queries by rebuilding paths from stored parent links.

    Trees & Graphsbfsgridshortest-pathpath-reconstruction
  • Linked ListsHardAuto-graded
    Convert Multi-Level Branching List to Doubly Linked List

    Flatten a tree-like linked structure with main and side links into a single doubly linked sequence using preorder traversal.

    Linked Listslinked-liststrees-graphsstacks-queues
  • Stacks & QueuesEasyAuto-graded
    Calculate Rolling Means from a Data Stream

    Evaluate tracking a sliding window over incoming numbers to incrementally update and output moving averages.

    Stacks & Queuessliding-windowqueuedequearray
  • StringsEasyAuto-graded
    Render Payment Records as Boxed Receipt Cards

    Turn a list of parsed payment records into fixed-layout text cards, testing whitespace trimming, exact decimal rounding, and precise string formatting while preserving order.

    Stringsstring-formattingdecimalparsingsimulation
  • Data Structure DesignEasyAuto-graded
    Simulate a Constant-Time LRU Eviction Cache

    Process a series of lookup and insert requests on a fixed-size Least Recently Used (LRU) key-value cache in O(1) time per operation.

    Data Structure Designdesign-dslinked-listsarrays
  • Greedy & IntervalsEasyAuto-graded
    Maximum Affordable Items Within Budget

    Determine the maximum collection of items that can be purchased given individual item costs and a total spending limit.

    Greedy & Intervalsgreedysortingarrays
  • Data Structure DesignMediumModel answer
    Design a Database Connection Pool

    Implement a resource-managing connection pool wrapper that enforces pool limits, reuses idle connections, and handles lease lifecycles safely.

    Data Structure Designdesign-dsobject-oriented-designresource-managementconcurrency
  • Data Structure DesignEasyAuto-graded
    Most Frequent Follower Lookup with Command Replay

    Simulate a train/predict command stream for a word-follower model, precomputing the top follower per word so each prediction is a single hash lookup, with a precise tie-break rule.

    Data Structure Designhash-mapdesignstringssimulation
  • Data Structure DesignMediumAuto-graded
    Simulate 2048 Moves with Scripted Tile Spawns

    Simulate a 4x4 sliding-tile merge game with scripted spawns, skipping spawns on no-op moves, then report the final board and whether any move remains.

    Data Structure Designsimulationmatrixstate-managementdeterministic-testing
  • Dynamic ProgrammingMediumAuto-graded
    Highest-Yield Consecutive Stretch in a Profit Log

    Find the largest total achievable by a non-empty run of adjacent integers, handling all-negative inputs and large sums, in one pass with constant extra space.

    Dynamic Programmingkadanesubarraydynamic-programmingarrays
  • Arrays & HashingEasyAuto-graded
    Bayesian Origin Probability for Sampled Items

    Calculate the posterior probability that two black items came from a specific facility using Bayes' Theorem.

    Arrays & Hashingstatisticsprobabilitybayes-theorem