KatInterview

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

Interview Practice Problems

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

5995
Problems
2220
Auto-graded
15
Topics
270
Added today

Showing 451–480 of 2220 results

  • 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
  • SQL & DataEasyAuto-graded
    Loan Count Gap Between Newest Member and Their Sponsor

    Tests table-style aggregation in Python: select the row with the highest key, count occurrences per key, and handle null or missing sponsor references with a default of zero.

    SQL & Dataaggregationhash-mapnull-handlingjoins
  • 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
  • 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
  • Trees & GraphsMediumAuto-graded
    Tree Depth After Splicing Out Removed Nodes

    Compute the depth of a rooted tree given as a parent array after splicing out marked nodes, so their children attach to the nearest surviving ancestor.

    Trees & Graphstreebfsparent-arraydepth
  • Heaps, Sorting & SearchEasyAuto-graded
    Stream Median Tracker

    Process a series of dynamic data stream queries to compute the median on demand using heap-based structures.

    Heaps, Sorting & Searchheapsheapqdata-structuresdesign-ds
  • Data Structure DesignMediumAuto-graded
    Most Connected User Tracker with Variable Top-K Queries

    Maintain distinct-contact counts for users from undirected messages, answer the top user in O(1), and return a top-k list with deterministic tie-breaking.

    Data Structure Designhash-sethash-mapheapsimulation
  • Stacks & QueuesMediumAuto-graded
    Strip Unmatched Brackets From a Text Line

    Delete exactly the brackets that cannot be paired so the remaining text is well-formed, using a single linear scan with a stack or counters.

    Stacks & Queuesstackstringparenthesesgreedy
  • Dynamic ProgrammingMediumAuto-graded
    Calculate Processed Work Units in Pipelined Task Queues

    Simulate task batch execution across a sequential multi-stage pipeline and count total units completed within a time limit.

    Dynamic Programmingarrayssimulationdynamic-programminggreedy-intervals
  • Dynamic ProgrammingMediumAuto-graded
    Best Haul from a Line of Stalls Without Neighbors

    Compute the maximum total from a line of non-negative numbers when no two neighboring entries may both be picked, using linear-time dynamic programming.

    Dynamic Programmingdynamic-programmingarraytake-or-skiphouse-robber
  • StringsMediumAuto-graded
    Expand a Compact Letter-and-Count String

    Parse a string of letters with optional multi-digit repeat counts, treating a missing count as one, and rebuild the expanded text in a single left-to-right pass.

    Stringsstring-parsingtwo-pointerssimulationrun-length-encoding
  • Trees & GraphsMediumAuto-graded
    Best Multi-Hop Exchange Rate Between Two Currencies

    Find the largest product of directed exchange rates along any path between two currencies, using Bellman-Ford-style relaxation on a graph that may contain cycles and rates above 1.

    Trees & Graphsgraphbellman-fordshortest-pathcurrency
  • Trees & GraphsEasyAuto-graded
    Grid Zone Coloring Feasibility

    Determine whether empty grid plots can be assigned one of k colors without adjacent conflicts.

    Trees & Graphstrees-graphsarraysmath-bits
  • Stacks & QueuesEasyAuto-graded
    Right-Side Larger Neighbor Lookup for Selected Values

    Tests whether you can precompute the nearest strictly larger value to the right for every element using a monotonic stack, then answer lookups for a chosen list of values.

    Stacks & Queuesmonotonic-stackhash-maparrays
  • Trees & GraphsMediumAuto-graded
    Grid Contagion Simulation

    Simulate multi-source BFS propagation across a 2D grid up to a maximum number of steps.

    Trees & Graphsbreadth-first-searchmatrixgraph-traversal
  • Trees & GraphsMediumAuto-graded
    Earliest Finish Time for a Dependent Job Pipeline

    Compute the shortest total time to finish all jobs with unlimited parallelism by finding the longest weighted path in a dependency graph, returning -1 if a cycle exists.

    Trees & Graphstopological-sortdaglongest-pathdynamic-programming
  • Data Structure DesignEasyAuto-graded
    In-Memory Store with Transaction Layering

    Implement an in-memory key-value database supporting GET, SET, DELETE, and nested transaction semantics (BEGIN, ROLLBACK, COMMIT).

    Data Structure Designdesign-dsstacks-queuesarraysstrings
  • Arrays & HashingMediumAuto-graded
    Count Contiguous Runs That Add Up to a Goal

    Count contiguous non-empty subarrays whose elements sum to a goal value, using running prefix sums with a frequency map to handle negatives and zeros in linear time.

    Arrays & Hashingprefix-sumhash-mapsubarraycounting
  • Data Structure DesignMediumAuto-graded
    Path-Addressed Tree Store: Replay a Command Log

    Simulate a path-keyed tree store by replaying a list of commands, testing trie or hash-map design, path validation, and exact failure semantics.

    Data Structure Designdesigntriehash-mapsimulation
  • Data Structure DesignHardAuto-graded
    Best-Fit Block Allocator with Coalescing and Log-Time Operations

    Simulate a best-fit extent allocator over a huge block range, where reserve and release must merge adjacent free runs and run in logarithmic time.

    Data Structure Designdesignordered-settreapcoalescing