KatInterview

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

Coding Interview Problems

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

5980
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 181–210 of 2115 results

  • Math & Bit ManipulationMediumAuto-graded
    Smallest Palindrome Above a Given Number

    Find the smallest palindromic integer strictly larger than a non-negative integer, using the left half of the digits and carry handling, including the all-9s case.

    Math & Bit Manipulationpalindromedigitsmathcarry
  • Greedy & IntervalsMediumAuto-graded
    Sentinels on a Road: Best Covered Value With Single Left Steps

    Maximize the total value of covered towns on a line when each sentinel may step one town left at most once into an empty town, by finding which town each run of sentinels leaves uncovered.

    Greedy & Intervalsgreedystringsarrayssegments
  • Math & Bit ManipulationEasyAuto-graded
    Total of Numbers Sharing a Factor of 3, 5, or 7

    Compute the sum of integers from 1 to n divisible by at least one of 3, 5, or 7, counting each integer once, which tests overlap handling and inclusive bounds.

    Math & Bit Manipulationmathinclusion-exclusioniterationdivisibility
  • Arrays & HashingMediumAuto-graded
    Closest Response Times: List the Tightest Increasing Pairs

    Find the smallest absolute gap between any two readings, then list every strictly increasing pair achieving it, handling duplicates correctly. Tests sorting and adjacent-gap reasoning.

    Arrays & Hashingsortingarraysadjacent-differenceedge-cases
  • Data Structure DesignMediumAuto-graded
    Batch Simulator for a TTL-Aware Name Lookup Service with Aliases

    Simulate a batch of record insertions and lookups with normalized names, TTL expiry, alias-chain following, cycle and hop-limit detection, and A/alias exclusivity.

    Data Structure Designhash-mapsimulationdesignstring-normalization
  • Trees & GraphsMediumAuto-graded
    Fastest Route Time Through a One-Way Street Network

    Find the minimum total cost between two nodes of a directed graph with non-negative edge weights, returning -1 if no route exists. Tests shortest-path reasoning with a priority queue.

    Trees & Graphsdijkstrashortest-pathgraphheap
  • Data Structure DesignMediumAuto-graded
    Live Complement Counting with Point Updates on One Array

    Answer repeated target-sum pair-count queries over two integer arrays while the second array receives point updates, using frequency maps.

    Data Structure Designhash-mapfrequency-countcounting-pairssimulation
  • Data Structure DesignMediumAuto-graded
    Ranked Staff Roster Across Multiple Forums with Swap-Down

    Simulate a batch of operations on per-forum ordered staff lists, enforcing seniority rules for adding, moving down one place, and removing members.

    Data Structure Designdesignhash-mapsimulationordered-list
  • Trees & GraphsMediumAuto-graded
    Sort a List and Replay Commands on a Binary Search Tree

    Sort an integer list without built-in sorting, then run a script of insert, search, delete and in-order commands on a duplicate-free binary search tree built from scratch.

    Trees & Graphsbinary-search-treequicksortrecursiontree-deletion
  • Arrays & HashingMediumAuto-graded
    Keep Words Whose Letter Multiset Appears More Than Once

    Filter a word list to the entries whose letter multiset is shared by at least two entries, keeping input order and duplicates, using letter-count keys.

    Arrays & Hashinghash-mapanagramscountingstrings
  • Arrays & HashingEasyAuto-graded
    Leaked Allocations: Filter Blocks Missing From Live Pointers

    Filter a list of allocated block addresses to those absent from a list of live pointers, keeping the original order, using hash-set membership for linear-time performance.

    Arrays & Hashinghash-setfilteringorder-preservationarrays
  • Trees & GraphsMediumAuto-graded
    Split Nodes Into Two Groups With No Internal Links

    Decide whether the vertices of an undirected multigraph can be split into two groups so every edge crosses between them, handling self-loops, repeated edges, and isolated nodes.

    Trees & Graphsgraphbfsbipartiteconnected-components
  • Math & Bit ManipulationMediumAuto-graded
    Integer Power via Repeated Squaring

    Compute a float raised to a signed 32-bit integer power in logarithmic time and constant space, handling negative exponents, zero bases and the most negative exponent.

    Math & Bit Manipulationbinary-exponentiationfloating-pointedge-casesiteration
  • Math & Bit ManipulationEasyAuto-graded
    Locate the Prime at a Given Position in the Prime Sequence

    Find the prime at a given 1-based position in ascending order, which tests sieving, bounding the search range, and complexity reasoning.

    Math & Bit Manipulationprimessievenumber-theorymath
  • Arrays & HashingEasyAuto-graded
    Enumerate Every Settings Grid from Option Lists

    Build the Cartesian product of named option lists into a list of dictionaries, handling empty inputs and a defined output order.

    Arrays & Hashingcartesian-productbacktrackingitertoolsdictionaries
  • Math & Bit ManipulationMediumAuto-graded
    Evaluate a Normalized CDF from Piecewise-Linear Density Samples

    Build a cumulative distribution from sampled density points using exact integration of a piecewise-linear curve, then answer many query points with correct boundary behavior.

    Math & Bit Manipulationnumerical-integrationbinary-searchprefix-sumsprobability
  • Data Structure DesignMediumAuto-graded
    Flag Rule Resolver with Hash-Bucketed Rollouts

    Simulate a feature-flag service: match attribute rules, gate by a SHA-256 percentage bucket, and resolve conflicts so any matching "on" rule wins.

    Data Structure Designsimulationhashingrules-enginedesign
  • Arrays & HashingMediumAuto-graded
    Tally Orders per Customer by Status Column

    Group order records by customer and count how many fall into each requested status, producing one sorted, zero-filled row per customer.

    Arrays & Hashinghash-mapgroupingcountingsorting
  • Stacks & QueuesMediumAuto-graded
    Four-Function Calculator Without Parentheses

    Evaluate a string of non-negative integers with +, -, *, / and spaces, honoring precedence and truncating division toward zero, without using eval.

    Stacks & Queuesstring-parsingstackoperator-precedencesimulation
  • Trees & GraphsMediumAuto-graded
    Fastest Signal Arrival Times Across a Relay Grid

    Compute shortest-path distances from one source in an undirected graph with non-negative weights, handling parallel edges, self-loops, and unreachable nodes.

    Trees & Graphsdijkstrashortest-pathgraphheap
  • Arrays & HashingMediumAuto-graded
    Richest Window of Stalls Under Count and Distance Limits

    Find the best sum over a contiguous run of position-sorted items, limited by item count and coordinate span, using sorting and a two-pointer sweep.

    Arrays & Hashingsliding-windowtwo-pointerssortingprefix-sums
  • Trees & GraphsHardAuto-graded
    Distinct Transitive Prerequisites in a Dependency DAG

    For each node in a DAG whose links may name unknown items, count the distinct nodes reachable along link direction, counting shared descendants once.

    Trees & Graphsgraphdagtopological-sortbitset
  • Trees & GraphsMediumAuto-graded
    Does This One-Way Network Contain a Loop?

    Decide whether a directed graph given as an adjacency list contains a cycle, handling self-loops, parallel edges, disconnected parts and an empty graph.

    Trees & Graphsgraphdirected-graphcycle-detectiontopological-sort
  • Heaps, Sorting & SearchMediumAuto-graded
    Find Earliest Compatible Release Version

    Find the smallest semantic version that satisfies a monotonic compatibility check while minimizing evaluations.

    Heaps, Sorting & Searchbinary-searchsortingarrays
  • Heaps, Sorting & SearchMediumAuto-graded
    Most Frequent Ads Within a Closed Time Range

    Select the K most frequent ad IDs among timestamped impressions in an inclusive window, breaking ties by smaller ID; tests binary search on sorted data plus counting and ordering.

    Heaps, Sorting & Searchbinary-searchhash-mapsortingsliding-window
  • Linked ListsEasyAuto-graded
    Filter Alternate Nodes in a Sequence

    Tests the ability to process a linear collection by dropping elements at even 1-based index positions.

    Linked Listslinked-listsarrayspointers
  • Math & Bit ManipulationEasyAuto-graded
    Compute Multi-User Feature Adoption Metrics

    Given population size and individual adoption probability, calculate key expectation, probability, and conditional probability metrics under Bernoulli assumptions.

    Math & Bit Manipulationmathprobabilitystatisticsnumerical-methods
  • Greedy & IntervalsEasyAuto-graded
    Shift Pay Totals Across Time-of-Day Wage Bands

    Sum payouts for work sessions by intersecting each session with non-overlapping hourly wage bands, using interval overlap arithmetic.

    Greedy & Intervalsintervalsoverlapsimulationarrays
  • Heaps, Sorting & SearchMediumAuto-graded
    Pick the k-th Smallest Value Without Fully Sorting

    Find the k-th smallest value in an unsorted integer list, counting duplicates, using a linear-time selection idea such as quickselect instead of a full sort.

    Heaps, Sorting & Searchquickselectselectionpartitioningorder-statistics
  • Heaps, Sorting & SearchMediumAuto-graded
    Window Mean After Discarding the Top Values

    Compute the mean of every fixed-size window after removing its k largest entries, which requires an ordered structure that supports efficient insertion and deletion.

    Heaps, Sorting & Searchsliding-windowheapfenwick-treeorder-statistics