KatInterview

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

Coding Interview 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 421–450 of 2120 results

  • 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
  • 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
  • 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
  • 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
  • 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
  • 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