KatInterview

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

Coding Interview Problems

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

6005
Problems
2225
Auto-graded
15
Topics
273
Added today

Showing 601–630 of 2125 results

  • Math & Bit ManipulationEasyAuto-graded
    Tally Repeat-Free Three-Digit Numbers Up To a Limit

    Count integers from 100 up to a given limit whose three digits are all different, using direct enumeration or combinatorial reasoning.

    Math & Bit Manipulationmathenumerationdigitscounting
  • StringsHardAuto-graded
    Build a Recursive-Descent Decoder for a JSON Subset

    Write a strict recursive-descent parser that turns JSON text into Python values and raises ValueError on any malformed input.

    Stringsparsingrecursive-descentstringsrecursion
  • Math & Bit ManipulationMediumAuto-graded
    Earliest Disc Overlap Among Unicycle-Driven Agents

    Simulate several disc-shaped agents with forward Euler unicycle motion and report the first time step at which any pair overlaps, with all pairs at that step.

    Math & Bit Manipulationsimulationgeometryfloating-pointpairs
  • Heaps, Sorting & SearchMediumAuto-graded
    Longest Uniform Cut Length from Rope Pieces

    Find the largest integer length such that cutting every rope into pieces of that length yields at least k pieces; tests binary search over a monotonic answer space.

    Heaps, Sorting & Searchbinary-searchbinary-search-on-answermonotonic-predicatearrays
  • Trees & GraphsEasyAuto-graded
    Find Tree K-th Ancestor for Queries

    Answer k-th ancestor queries on a rooted tree efficiently using binary lifting.

    Trees & Graphstrees-graphsmath-bitsarrays
  • Data Structure DesignMediumAuto-graded
    Replay-Safe Versioned Record Updates Simulator

    Simulate a record store that applies updates with optimistic version checks and per-record idempotency keys, replaying cached results for retries and rejecting reused keys.

    Data Structure Designdesignhash-mapidempotencyoptimistic-concurrency
  • Arrays & HashingEasyAuto-graded
    Check Loan Records for Proper Borrow-Return Order

    Scan a time-ordered list of library events and verify each item's history strictly alternates borrow, return, starting with a borrow, using per-item state tracking.

    Arrays & Hashinghash-setstate-trackingsimulationvalidation
  • Stacks & QueuesEasyAuto-graded
    Well-Formed Bracket Sequence Checker

    Decide whether a string of three kinds of brackets is correctly nested, using a stack to enforce that the most recently opened bracket is closed first.

    Stacks & Queuesstackstringmatchingparsing
  • Data Structure DesignMediumAuto-graded
    Nested Transaction Log for an In-Memory Dictionary

    Simulate a key-value store with nested begin, commit and rollback by replaying a command list and recording each read result.

    Data Structure Designhash-mapstacktransactionsundo-log
  • Trees & GraphsMediumAuto-graded
    Count Clusters of Linked Playlists from a Match Grid

    Count connected components in an undirected graph given as an n x n adjacency matrix, where links chain together transitively.

    Trees & Graphsgraphconnected-componentsdfsunion-find
  • Greedy & IntervalsMediumAuto-graded
    Biggest Cabin Party Respecting Everyone's Companion Limits

    Find the largest group size k where at least k people accept exactly k-1 companions, using interval counting with a difference array in linear time.

    Greedy & Intervalsdifference-arrayintervalscountingprefix-sum
  • Trees & GraphsMediumAuto-graded
    Find the K-th Smallest Element in a BST

    Find the k-th smallest key in a binary search tree represented as a level-order array.

    Trees & Graphstrees-graphstreesin-order-traversalbinary-search-tree
  • Arrays & HashingEasyAuto-graded
    Smallest Axis-Aligned Box Around Scattered Points

    Scan a list of integer 2D points once to find the extreme x and y values, then report the enclosing axis-aligned box as a corner plus width and height.

    Arrays & Hashingarraysgeometrymin-maxsingle-pass
  • Arrays & HashingEasyAuto-graded
    Calculate Spend Percentage of High-Volume Spenders

    Compute the share of 2023 total expenditure contributed by users who met a high-tier spending threshold in 2022.

    Arrays & Hashingarrayshash tabledata manipulationcohort analysis
  • Arrays & HashingEasyAuto-graded
    Uncovered Integer Gaps Within a Closed Window

    Scan a sorted list of distinct integers once to report every maximal run of integers in a closed window that the list skips, formatting single gaps as one-element lists.

    Arrays & Hashingarraysintervalstwo-pointersedge-cases
  • Heaps, Sorting & SearchHardAuto-graded
    Narrowest Window Touching Every Sorted Array

    Find the tightest inclusive interval that holds at least one value from each of several sorted arrays, using a k-way merge with a min-heap and a tracked maximum.

    Heaps, Sorting & Searchheapk-way-mergesorted-liststwo-pointers
  • StringsMediumAuto-graded
    Bracket Depth Scoring of a Nested Integer String

    Scan a bracketed string of non-negative integers and sum each integer times its bracket nesting level, handling multi-digit numbers, whitespace and empty lists.

    Stringsstring-parsingnested-structuressingle-passbracket-depth
  • Arrays & HashingMediumAuto-graded
    Validate a Shuffled Start/Stop Service Log for Each Component

    Replay timestamped start/stop events in time order, with ties broken by input position, tracking one active job per category, and confirm the log is valid and fully closed.

    Arrays & Hashinghash-setsortingsimulationstate-tracking
  • Heaps, Sorting & SearchMediumAuto-graded
    Lowest K Values in Ascending Order with Duplicates

    Select the k smallest values from an unsorted integer list, keeping duplicates and returning them sorted ascending, which tests heap, sorting and selection trade-offs.

    Heaps, Sorting & Searchheapsortingselectiontop-k
  • Heaps, Sorting & SearchMediumAuto-graded
    Determine Available Range on Number Line

    Evaluate dynamic range-query operations on 1D coordinates to test whether continuous subsegments contain obstacles.

    Heaps, Sorting & Searchheaps-sortingbinary-searchfenwick-treesegment-tree
  • StringsHardAuto-graded
    Fewest Neighbor Swaps to Mirror a Word

    Compute the minimum number of adjacent character swaps needed to rearrange a lowercase string into a palindrome, or report -1 if no palindrome is possible.

    Stringsgreedytwo-pointersstringspalindrome
  • Heaps, Sorting & SearchMediumAuto-graded
    Evaluate a Piecewise Linear Curve From Shuffled Sample Points

    Build a piecewise linear function from unordered sample points and evaluate it at one query, extending the end segments outward, using sorting and binary search.

    Heaps, Sorting & Searchbinary-searchsortinginterpolationfloating-point
  • Arrays & HashingMediumAuto-graded
    Detect Target Pair in Spiral Matrix Order

    Determine if two distinct cells in a 2D matrix sum to a target integer while processing elements in spiral order.

    Arrays & Hashingarrayshash-tablematrix
  • Dynamic ProgrammingHardAuto-graded
    Trim Letters to Reach a Mirror String Within a Budget

    Decide whether a string can become a palindrome after removing no more than k characters, testing interval dynamic programming and palindromic subsequence reasoning.

    Dynamic Programmingdynamic-programmingpalindromestringssubsequence
  • Dynamic ProgrammingMediumAuto-graded
    Count Step Sequences with Custom Prime Jumps

    Find the number of unique sequences of steps to reach a target using 1-unit steps or prime steps ending in digit 3.

    Dynamic Programmingdynamic-programmingmathsievemodular-arithmetic
  • Trees & GraphsMediumAuto-graded
    Trace a Phrase Through Neighboring Tiles

    Decide whether a string can be traced through a rectangular letter grid by stepping to up/down/left/right neighbors without reusing a cell, using backtracking search.

    Trees & Graphsbacktrackingdfsmatrixpruning
  • Trees & GraphsMediumAuto-graded
    Deepest Shared Ancestor of Two Nodes in a Rooted Tree

    Find the deepest node whose subtree contains two given nodes in a tree stored as child lists, using a single depth-first pass that stays safe on very deep trees.

    Trees & Graphstreedfslowest-common-ancestorpost-order
  • Data Structure DesignMediumAuto-graded
    Replay a Typing Session Against a Ranked Suggestion History

    Simulate keystroke-by-keystroke search suggestions over a frequency-weighted history that grows as queries are committed, ranking the top 3 matches by count and then text.

    Data Structure Designhash-mapdesignstring-prefixtop-k
  • Trees & GraphsMediumAuto-graded
    Cheapest Transit Pick on a Lettered Street Grid

    Run a per-mode BFS on a grid to find step counts, then choose the mode with least total time, then least total cost, then smallest index.

    Trees & Graphsbfsgridshortest-pathtie-breaking
  • Greedy & IntervalsMediumAuto-graded
    Even Budget Split Under Per-Person Caps

    Split a budget as evenly as possible among people with individual caps, using a binary-searched fill level plus a lowest-index-first remainder rule.

    Greedy & Intervalsgreedybinary-searchwater-fillingarrays