KatInterview

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

Coding Interview Problems

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

6003
Problems
2223
Auto-graded
15
Topics
273
Added today

Showing 571–600 of 2123 results

  • StringsEasyAuto-graded
    Earliest Non-Repeating Character with Optional Case Folding

    Find the position of the earliest character that occurs exactly once in a string, with a flag that switches between case-sensitive and case-insensitive matching.

    Stringsstringshash-mapcountingcase-folding
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Expected Return from Two Six-Sided Dice

    Computes the expected payoff of a game played with two independent six-sided dice, rounded to two decimal places.

    Math & Bit Manipulationmath-bitsprobabilitysimulation
  • StringsMediumAuto-graded
    List Every Well-Formed Bracket Sequence in Dictionary Order

    Enumerate all well-formed bracket sequences using n pairs, returned in dictionary order, testing pruned backtracking and reasoning about output ordering.

    Stringsbacktrackingrecursioncombinatoricsstrings
  • Arrays & HashingMediumAuto-graded
    Quarter-Turn a Square Grid of Pixels Without Extra Storage

    Turn a square integer grid a quarter turn clockwise by modifying it in place, testing index mapping and in-place transforms such as transpose plus row reversal.

    Arrays & Hashingmatrixin-placesimulationtranspose
  • Math & Bit ManipulationEasyAuto-graded
    Yearly Earnings Report for a Rewards Membership Program

    Compute yearly revenue, cost, profit and per-member profit for a membership program from fees, monthly spend commission, and fixed and variable costs.

    Math & Bit Manipulationmatharithmeticunit-conversionsimulation
  • Trees & GraphsMediumAuto-graded
    Fewest Removals to Cap a Rooted Tree's Height

    Count the minimum non-root nodes to remove from a parent-array tree, splicing children upward, so the height is at most a limit; tests subtree heights and a path-decomposition argument.

    Trees & Graphstreesubtree-heightiterative-bfsgreedy
  • Dynamic ProgrammingHardAuto-graded
    Balanced Parentheses After Digit-Driven Removals

    Decide whether removing parentheses to satisfy per-digit quotas can leave a balanced bracket string, using a DP over balance and removal count.

    Dynamic Programmingdynamic-programmingstringsparenthesesstate-compression
  • Trees & GraphsEasyAuto-graded
    Prune a Labeled Tree by Forbidden Substring

    Recursively copy an n-ary tree while dropping every node whose label contains a given substring, together with its subtree, without mutating the input.

    Trees & Graphstreerecursiondfsstrings
  • Trees & GraphsMediumAuto-graded
    Players Whose Leaderboard Position Is Forced

    Find every player comparable to all others in a consistent win/loss DAG, using transitive reachability in both directions, ideally with bitsets.

    Trees & Graphsgraphtopological-sorttransitive-closurebitset
  • Math & Bit ManipulationEasyAuto-graded
    Product of Three Dice: Summary Statistics Report

    Enumerate all 216 outcomes of three dice to compute the mean, modes, prime probability and median of their product, and return a fixed risk note.

    Math & Bit Manipulationenumerationprobabilitycountingstatistics
  • Arrays & HashingEasyAuto-graded
    Find Lowest Cost Ticket Pair Across Consecutive Days

    Find the minimum combined cost of an outbound and return ticket where return happens strictly after departure.

    Arrays & Hashingarraysgreedyprefix-minimum
  • Arrays & HashingMediumAuto-graded
    Users Active for a Week Straight: Detect 7-Day Streaks in Event Logs

    Find users whose event log contains at least seven consecutive UTC calendar days of activity, using per-user day deduplication and a sorted streak scan.

    Arrays & Hashinghashingdatesstreakssorting
  • Dynamic ProgrammingEasyAuto-graded
    Bankrupt Risk in Dice Game

    Compute the exact probability of wealth hitting zero or below at any step during a finite sequence of random dice rolls.

    Dynamic Programmingdynamic-programmingmath-bitsstatistics
  • Arrays & HashingEasyAuto-graded
    Calculate Maximum Single-Trade Return

    Find the maximum non-negative profit from purchasing an asset on one day and selling it on a subsequent day.

    Arrays & Hashingarraysdynamic-programminggreedy-intervals
  • Math & Bit ManipulationEasyAuto-graded
    Middle Age Band Share Among Cycling Respondents

    Restrict a 3x3 survey table to one column and return an exact reduced fraction for a conditional probability.

    Math & Bit Manipulationprobabilityfractionstablesgcd
  • Data Structure DesignMediumAuto-graded
    Failure Streaks and Fix Times from a Live Test Log

    Process a stream of pass/fail log operations, answering shortest-fix-time and longest-concurrent-failure-window queries with an incremental, level-based data structure.

    Data Structure Designdesignstreamingintervalshash-map
  • Heaps, Sorting & SearchMediumAuto-graded
    K-th Smallest Entry in a Row and Column Sorted Grid

    Find the k-th smallest value in a two-dimensional grid where every row and column is sorted in ascending order.

    Heaps, Sorting & Searchbinary-searchmatrixheaps-sorting
  • Greedy & IntervalsMediumAuto-graded
    Largest Number With Even Counts of Both Digits

    Delete characters from a string of 1s and 2s so both digit counts are even and the number is largest, testing greedy deletion with parity reasoning.

    Greedy & Intervalsgreedystringstacksubsequence
  • Data Structure DesignMediumAuto-graded
    Replay Operations on a Fixed-Size Ring Buffer Queue

    Simulate a fixed-capacity circular FIFO queue from an operation log, handling wraparound, full and empty states, and logical index lookups in constant time per operation.

    Data Structure Designcircular-queuering-buffersimulationdesign
  • Arrays & HashingEasyAuto-graded
    Cross-Tabulate Records by Composite Row and Column Keys

    Group records by composite row and column keys, sum a value field per pair, and return the axes in first-seen order with a dense grid that has zeros for missing pairs.

    Arrays & Hashinghash-mapgroupingaggregationtuples
  • Data Structure DesignHardAuto-graded
    Simulate LFU Cache Sequence

    Process a series of LFU cache queries with LRU tie-breaking and track the output of each operation.

    Data Structure Designhash-tablelinked-listdesignlfu-cache
  • Arrays & HashingMediumAuto-graded
    Gravity Grid: Pushing Tokens Up from Below and Spotting Matching Lines

    Simulate a grid where tokens are pushed in from the bottom of a column, and after each push report success and whether any full column or full row is single-typed.

    Arrays & Hashingsimulationmatrixstate-trackinggrid
  • Dynamic ProgrammingMediumAuto-graded
    Cheapest Daily Ticket Plan Without Back-to-Back Repeats

    Choose one of three item types each day with no type repeated on adjacent days, minimizing total cost and returning the unique optimal sequence of choices.

    Dynamic Programmingdynamic-programmingpath-reconstructionpaint-house
  • Math & Bit ManipulationMediumAuto-graded
    Overflow-Safe Probability Normalization of Raw Scores

    Convert a list of real scores into a probability distribution via exponentiation and normalization, without overflow or division-by-zero for extreme input values.

    Math & Bit Manipulationnumerical-stabilitymathfloating-pointarrays
  • Trees & GraphsMediumAuto-graded
    Smallest Valid Task Schedule with Prerequisites

    Produce the lexicographically smallest topological ordering of a directed graph, or report that no ordering exists because of a cycle.

    Trees & Graphstopological-sortheapgraphcycle-detection
  • Math & Bit ManipulationEasyAuto-graded
    Recover Total Weight From All Pairwise Crate Readings

    Tests the double-counting insight that each item appears in a fixed number of pair sums, so the total equals the sum of the readings divided by a constant.

    Math & Bit Manipulationmathcountingpairwise-sumsarithmetic
  • Math & Bit ManipulationEasyAuto-graded
    Chance a Pair Tops Another Pair in Four Random Ratings

    Compute the probability that two items from one group both beat two items from another group when all four scores are i.i.d. and continuous, using a symmetry and ranking-count argument.

    Math & Bit Manipulationprobabilitycombinatoricssymmetrybrainteaser
  • Trees & GraphsMediumAuto-graded
    Tree Height and Peak Concurrent Bookings

    Compute the height of an index-encoded binary tree without deep recursion, and the minimum rooms needed for half-open time intervals, returned together as a pair.

    Trees & Graphsbinary-treeiterative-dfsintervalssweep-line
  • Math & Bit ManipulationEasyAuto-graded
    Tally Repeat-Free Three-Digit Numbers Up To a Limit

    Count integers from 100 up to a given limit whose three digits are all different, using direct enumeration or combinatorial reasoning.

    Math & Bit Manipulationmathenumerationdigitscounting
  • StringsHardAuto-graded
    Build a Recursive-Descent Decoder for a JSON Subset

    Write a strict recursive-descent parser that turns JSON text into Python values and raises ValueError on any malformed input.

    Stringsparsingrecursive-descentstringsrecursion