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
272
Added today

Showing 541–570 of 2774 results

  • Trees & GraphsMediumAuto-graded
    Collect Every Value Stored Under a Key in Nested Data

    Walk a nested structure of dicts and lists depth-first and gather every value stored under a given key, in traversal order, including matches inside already-matched values.

    Trees & Graphsrecursiondfsjsontraversal
  • Math & Bit ManipulationMediumAuto-graded
    Bitwise Quotient Without Multiply, Divide, or Modulo

    Compute a truncated 32-bit signed integer quotient using only shifts, addition and subtraction, handling the single overflow case and sign rules efficiently.

    Math & Bit Manipulationbit-manipulationmathbinary-searchoverflow
  • Data Structure DesignMediumAuto-graded
    Lantern Posts and Open Stretch Checks Along a Highway

    Process interleaved insert and query events on sparse integer coordinates, checking whether a symmetric window contains any previously inserted point, using binary search and a Fenwick tree.

    Data Structure Designfenwick-treebinary-searchcoordinate-compressionrange-query
  • Heaps, Sorting & SearchMediumAuto-graded
    Locate the Lone Value in a Sorted Paired List

    Use parity-based binary search on a sorted array of duplicated values to find the one value without a partner in logarithmic time and constant extra space.

    Heaps, Sorting & Searchbinary-searchsorted-arrayparityarrays
  • Math & Bit ManipulationMediumAuto-graded
    Pick Non-Overlapping Words to Cover the Most Letters

    Choose a subset of words with no shared letters so the number of distinct letters covered is maximal, which suits bitmask encoding and subset search.

    Math & Bit Manipulationbitmaskbacktrackingsubsetsstrings
  • Heaps, Sorting & SearchMediumAuto-graded
    Shortest-Stack Block Placement Order

    Simulate placing blocks one at a time onto the currently lowest of k stacks, with ties going to the lowest index, and report each chosen stack; tests heap-based greedy simulation.

    Heaps, Sorting & Searchheappriority-queuegreedysimulation
  • Data Structure DesignMediumModel answer
    Building a Cache-Friendly Lookup Table for a Hot Loop

    Design a hash table for a performance-critical inner loop, covering collision strategy, memory layout, probing, load factor, prefetching, and how to benchmark it.

    Data Structure Designhash-tableopen-addressingsimdcache-optimization
  • StringsEasyAuto-graded
    Stitch Glyph Rows Into a Banner

    Combine per-character row strings from a font table into banner lines by joining row i of every glyph in order.

    Stringsstringssimulationhash-mapjoin
  • Greedy & IntervalsMediumModel answer
    Decode Non-Overlapping Keyphrase Spans from BERT Logits

    Implement a decoder that converts token start and end logits into non-overlapping character spans using offset mappings and greedy selection.

    Greedy & Intervalsstringsgreedy-intervalsmachine-learningsorting
  • Arrays & HashingMediumAuto-graded
    Maximum Consecutive Ones With a Single Bit Repair

    Find the longest stretch of 1s achievable in a binary list when at most one 0 may be changed to 1, using a two-pointer window that tolerates one zero.

    Arrays & Hashingsliding-windowtwo-pointersbinary-array
  • Data Structure DesignHardModel answer
    Greedy Longest-Match Subword Encoder Built on a Byte Trie

    Design and implement a deterministic subword encoder that uses a trie for longest-match lookup, with lossless Unicode handling, versioned vocabularies, tests, and a comparison with BPE and WordPiece.

    Data Structure Designtrietokenizerunicodenlp
  • Arrays & HashingEasyAuto-graded
    Financial Payback and Sensitivity Analysis for Renewable Energy

    Perform quantitative financial modeling and sensitivity analysis for renewable energy pilot projects.

    Arrays & Hashingfinancesensitivity-analysismathstatistics
  • StringsMediumAuto-graded
    Evaluate Arithmetic String Without Parentheses

    Parse and compute a non-negative integer arithmetic string with basic binary operators while preserving standard precedence and left-to-right evaluation.

    Stringsstringsparsingstacks-queuesmath-bits
  • Heaps, Sorting & SearchMediumModel answer
    Batched API Delivery with Delay-Aware Retries

    Deliver a list of requests through an API capped at five per call, retrying failures only after each request's own cooldown, without busy-waiting or blocking on one failure.

    Heaps, Sorting & Searchbatchingretryschedulingpriority-queue
  • Data Structure DesignMediumAuto-graded
    Latest-Wins Priority Job Runner Simulation

    Simulate a job runner where resubmitting an ID overrides its earlier entry, testing heap-based lazy deletion with tie-breaking and run-once rules.

    Data Structure Designheaplazy-deletionsimulationhash-map
  • Stacks & QueuesMediumAuto-graded
    Deserialize Nested List Structure

    Parse a string encoding nested lists and non-negative integers into a Python list structure.

    Stacks & Queuesstacksstringsparsingrecursion
  • Greedy & IntervalsEasyAuto-graded
    Settle Shared Expenses With a Two-Pointer Payment Plan

    Turn a map of net balances into a deterministic list of payments that zeroes every account, using a sorted two-pointer greedy match between debtors and creditors.

    Greedy & Intervalsgreedytwo-pointershash-mapsorting
  • Linked ListsHardAuto-graded
    Locate Duplicate Integer with Strict Space Limit

    Find the single repeated value in an array of size n + 1 containing integers from 1 to n without altering the array or using extra space.

    Linked Liststwo-pointersarrayslinked-listfloyds-algorithm
  • Greedy & IntervalsMediumAuto-graded
    Combine Two Ordered Schedules into One Gap-Free Timeline

    Merge two sorted lists of internally disjoint closed intervals into one sorted, disjoint list, joining overlapping or endpoint-touching intervals, in linear time.

    Greedy & Intervalsintervalstwo-pointersmergesweep-line
  • Arrays & HashingMediumAuto-graded
    Streak Follow-Up Chance and Two-Bot Proportion Comparison

    Return the next-success probability under independence, plus a pooled two-proportion z statistic and two-sided p-value comparing two success rates.

    Arrays & Hashinghypothesis-testingtwo-proportion-z-testconditional-probabilitynormal-distribution
  • Arrays & HashingMediumAuto-graded
    Greedy First-Fit Placement of Shapes on a Grid

    Simulate placing fixed binary shapes onto a grid at the first row-major position where their filled cells hit only empty cells, labelling each by its index.

    Arrays & Hashingsimulationmatrixgridbrute-force
  • Math & Bit ManipulationEasyAuto-graded
    Chance of a 15-Sum Triple from the Leftover Deck

    Compute the probability that three cards drawn without replacement from the cards the opponent left behind sum to exactly 15, using combinatorial counting.

    Math & Bit Manipulationcombinatoricsprobabilityenumerationitertools
  • Data Structure DesignMediumModel answer
    Star Feedback Widget with Compose and a ViewModel

    Build a Compose feedback form with a 1-5 star selector, a capped comment field and an async submit, driven by a single ViewModel state stream that survives rotation and double taps.

    Data Structure Designkotlinjetpack-composeandroidmvvm
  • StringsEasyAuto-graded
    Find the First Near-Match Code With Optional Folding Rules

    Scan candidate codes in order and return the first whose normalized form is within a mismatch limit of a reference, using optional case folding and O/0, I/1 merging.

    Stringsstringshamming-distancenormalizationsimulation
  • Dynamic ProgrammingMediumAuto-graded
    Stop or Roll: Ten-Sided Die With a One-Time Reset

    Decide whether to stop or roll in a dice accumulation game where the first zero resets your total and the second zero wipes you out, using DP over (total, reset-used) states.

    Dynamic Programmingdynamic-programmingexpected-valueoptimal-stoppingprobability
  • Data Structure DesignMediumModel answer
    Reversible Edit History for a Formula-Driven Grid

    Design a command-based history for a spreadsheet that undoes and redoes cell edits, row deletions and batches, recomputes dependent formulas, handles irreversible actions, and bounds memory.

    Data Structure Designcommand-patternundo-redomementodependency-graph
  • StringsMediumAuto-graded
    Leftmost Longest Mirror-Reading Substring

    Find the longest contiguous substring that reads the same in both directions, returning the leftmost one on ties; tests center expansion or Manacher-style reasoning.

    Stringsstringspalindrometwo-pointersmanacher
  • Trees & GraphsMediumAuto-graded
    Generate Preorder Depth Forest from Directed Node Pairs

    Construct a hierarchical forest from directed child-parent relations and output a depth-annotated preorder traversal.

    Trees & Graphstrees-graphsdepth-first-searchstackrecursion
  • StringsMediumAuto-graded
    Shared-Letter Splits and Best Uniform Bundles

    Count string split points whose halves share more than k distinct characters, and find the most equal-total bundles of one or two items from a cost list, with a special rule for zero-cost items.

    Stringsstringshash-mapcountingprefix-suffix
  • Trees & GraphsMediumAuto-graded
    Best Meeting Cell on a Grid with Walls

    Find the open cell with the smallest total shortest-path distance to a set of target cells on a grid with obstacles, using BFS and reachability counting.

    Trees & Graphsbfsgridshortest-pathgraph-traversal