KatInterview

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

Coding Interview Problems

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

6013
Problems
2228
Auto-graded
15
Topics
273
Added today

Showing 781–810 of 2781 results

  • Data Structure DesignMediumModel answer
    Review a Fit/Transform Preprocessing Module and Write a Key Test

    Review a small Python preprocessing module with an outlier-capping class and three imputers: explain its purpose, justify fit/transform separation, critique style and imports, and write one key unit test.

    Data Structure Designpythoncode-reviewscikit-learnunit-testing
  • 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 DesignMediumModel answer
    Single-Open Async Tooltip Panels with Keyboard Support in React

    Design a React popover that fetches data when opened, stays exclusive across many triggers, ignores stale responses, and handles focus, Esc, and outside clicks accessibly.

    Data Structure Designreactaccessibilityrace-conditionsfocus-management
  • 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
  • Data Structure DesignMediumModel answer
    Pluggable Scoring Pipeline for Ranking Concert and Show Listings

    Design an object-oriented ranking engine where scoring and filtering rules can be chained, weighted, reordered and isolated from failures, with a backfill tier when too few results come back.

    Data Structure Designobject-oriented-designstrategy-patternrankingfallback
  • 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
  • Data Structure DesignMediumModel answer
    Build a CSV Data Frame and Assembly of Sequence Fragments

    Parse RFC 4180 CSV into an in-memory table with query support, and reconstruct chained sequences from directed or undirected overlapping fragments.

    Data Structure Designdesign-dsstringstrees-graphs
  • 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