KatInterview

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

Math & Bit Manipulation Interview Problems

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

5972
Problems
2212
Auto-graded
15
Topics
273
Added today

Showing 91–120 of 184 results

  • Math & Bit ManipulationMediumAuto-graded
    Maximize Disjoint Letter Coverage

    Find the maximum count of distinct letters that can be collected by picking a mutually disjoint subset of strings.

    Math & Bit Manipulationbit-manipulationbacktrackingdynamic-programmingstrings
  • Math & Bit ManipulationEasyAuto-graded
    Simulate Account Transactions with Integer Cashbacks

    Process a series of deposits, conditional withdrawals, and integer floor cashbacks to compute a final account balance.

    Math & Bit Manipulationsimulationmatharrays
  • Math & Bit ManipulationMediumAuto-graded
    Calculate Promotion Break-Even for Rental Discount

    Compute the break-even target for new customer acquisitions under base and spend-uplift promotional scenarios.

    Math & Bit Manipulationmathunit-economicsfinancial-modeling
  • Math & Bit ManipulationEasyAuto-graded
    Compute Precision and Recall from Confusion Counts

    Compute precision and recall from the four confusion-matrix counts of a binary classifier, returning 0.0 for a metric whose denominator is zero.

    Math & Bit Manipulationmathconfusion-matrixprecision-recalledge-cases
  • Math & Bit ManipulationMediumAuto-graded
    Delta-Method Variance of a Ratio of Two Sample Means

    Apply a first-order Taylor expansion to get the approximate variance of a ratio of two correlated sample means, including the covariance term.

    Math & Bit Manipulationdelta-methodvariancecovarianceratio-metrics
  • Math & Bit ManipulationMediumAuto-graded
    Gap in Days Between Two Calendar Strings Without Date Libraries

    Parse two ISO-style date strings and compute the absolute day gap using manual Gregorian leap-year logic, without any date or calendar library.

    Math & Bit Manipulationdate-arithmeticleap-yearstring-parsingmath
  • Math & Bit ManipulationHardAuto-graded
    Streaming Run/Bit-Pack Codec Session Simulator

    Simulate a codec session that buffers int32 values, emits run-length and bit-packed blocks on flush, and decodes block lists back to integers.

    Math & Bit Manipulationbit-manipulationcompressionsimulationtwos-complement
  • Math & Bit ManipulationEasyAuto-graded
    Detect a Rate Reversal Between Strata and Pooled Totals

    Compare two groups' success rates per stratum and pooled, using exact integer cross-multiplication, to detect when a consistent stratum winner flips in the aggregate.

    Math & Bit Manipulationsimulationfractionsaggregationsimpsons-paradox
  • Math & Bit ManipulationMediumAuto-graded
    Four Weighted Dice: Lowest Three Add Up to Three

    Compute the exact reduced probability that the three smallest of four independent weighted dice sum to 3, which reduces to counting weighted outcomes with at least three ones.

    Math & Bit Manipulationprobabilitycombinatoricsfractionscounting
  • Math & Bit ManipulationMediumAuto-graded
    Project a Vertex and Its Normal Through a Render Pipeline

    Apply model, view and projection matrices to a point, do the perspective divide and viewport mapping, and transform a normal with the inverse-transpose of the model's 3x3 block.

    Math & Bit Manipulationlinear-algebramatriceshomogeneous-coordinatessimulation
  • Math & Bit ManipulationMediumAuto-graded
    Chance of a Red Majority When Skipping Returned Marbles

    Compute a probability for a draw process with discarded-and-returned items by reducing it to a hypergeometric count, ignoring the irrelevant returned category.

    Math & Bit Manipulationprobabilitycombinatoricshypergeometricmath
  • Math & Bit ManipulationEasyAuto-graded
    Feed Ad Load: Random Slots vs. Fixed Block Quota

    Compute expected ad counts for two feed ad policies and the chance of seeing at least one ad in a window, using linearity of expectation and the complement rule.

    Math & Bit Manipulationprobabilityexpectationmathcomplement-rule
  • Math & Bit ManipulationMediumAuto-graded
    Tie-Aware Ranking Probabilities for Three and Four Tasters

    Derive conditional ranking probabilities for i.i.d. scores, with and without ties, and return them as a dictionary keyed by named quantities.

    Math & Bit Manipulationprobabilitycombinatoricsconditional-probabilityclosed-form
  • Math & Bit ManipulationEasyAuto-graded
    Annual Profit and Break-Even Value for a Lounge Menu Item

    Compute a per-site annual operating result and the break-even per-unit benefit from visit volume, uptake rate, unit cost, unit benefit, a one-time setup cost, and a time horizon.

    Math & Bit Manipulationarithmeticbreak-evensimulationedge-cases
  • Math & Bit ManipulationEasyAuto-graded
    Lamps After Divisor Sweeps

    Count how many of n switches end up on after sweeping by every step size, which tests the divisor-parity and perfect-square insight.

    Math & Bit Manipulationmathnumber-theoryperfect-squaresdivisors
  • Math & Bit ManipulationHardAuto-graded
    Can a Starting Pair Grow Into a Goal Pair by Summing Coordinates?

    Decide whether a goal pair is reachable from a start pair by replacing one coordinate with the sum of both, using a reverse walk with Euclid-style modulo jumps for values up to 10^9.

    Math & Bit Manipulationmatheuclidean-algorithmreverse-thinkingmodulo
  • Math & Bit ManipulationHardAuto-graded
    Fewest Presses to Morph One Light Grid Into Another

    Find the smallest set of cell presses that turns one on/off grid into another, where each press flips a cell and its neighbours. Tests GF(2) elimination and null-space minimisation.

    Math & Bit Manipulationgaussian-eliminationgf2bitmasklinear-algebra
  • Math & Bit ManipulationEasyAuto-graded
    Smallest Equicorrelation Value for a Valid 3x3 Matrix

    Determine the least real parameter for which a 3x3 symmetric matrix with unit diagonal and equal off-diagonal entries is positive semidefinite, using eigenvalue or minor analysis.

    Math & Bit Manipulationlinear-algebraeigenvaluespositive-semidefinitemath
  • Math & Bit ManipulationMediumAuto-graded
    Matrix Product, Fast Power and Fibonacci Toolkit

    Combine matrix multiplication, square-and-multiply exponentiation and 2x2 matrix-power Fibonacci, with optional modular arithmetic, in one function.

    Math & Bit Manipulationmatrix-multiplicationfast-exponentiationfibonaccimodular-arithmetic
  • Math & Bit ManipulationHardAuto-graded
    Ordered IPv4 Access List: Verdict for an Address or Entire Subnet

    Evaluate an ordered first-match IPv4 access list for a single address or a whole CIDR block, which needs prefix arithmetic and interval reasoning rather than enumerating addresses.

    Math & Bit Manipulationcidrbit-manipulationstacksorting
  • Math & Bit ManipulationEasyAuto-graded
    Expected Draws Until a Second Distinct Token Shows Up

    Compute, as a floating-point number, the expected number of draws from a fixed three-outcome distribution until two different outcomes have appeared, using conditioning and geometric waiting times.

    Math & Bit Manipulationprobabilityexpected-valuegeometric-distributionmath
  • Math & Bit ManipulationEasyAuto-graded
    Equal-Sized Uniform Piles From a Card Collection

    Decide whether a multiset of integers can be split into uniform piles that all share one common size of at least two, testing counting and the GCD insight.

    Math & Bit Manipulationgcdhash-mapcountingnumber-theory
  • Math & Bit ManipulationEasyAuto-graded
    Mean of a Numeric List with Empty-Input Fallback

    Compute the arithmetic mean of a list of numbers, returning 0 for an empty list, testing basic edge-case handling and complexity reasoning.

    Math & Bit Manipulationarraysmathedge-cases
  • Math & Bit ManipulationMediumAuto-graded
    Correlation Bounds, Equicorrelated Triples, and Box-Muller Sampling

    Compute a feasible correlation interval, give coefficients for three equally anti-correlated variables, and convert uniform values to normals with the Box-Muller transform.

    Math & Bit Manipulationprobabilitycorrelationbox-mullersimulation
  • Math & Bit ManipulationEasyAuto-graded
    Eventual Winner Odds in a Draw-Two Card Duel with Replays

    Compute the probability that the first of two drawers eventually wins a rank-comparison game with replayed ties, using counting and a symmetry argument.

    Math & Bit Manipulationprobabilitysymmetrycountingmath
  • Math & Bit ManipulationMediumAuto-graded
    Gambler's Ruin: Success Probability and Duration Score

    Compute the chance a random walk hits a target before zero using a closed form, handling the fair case and overflow, and return a fixed duration formula.

    Math & Bit Manipulationprobabilitymarkov-chainclosed-formnumerical-stability
  • Math & Bit ManipulationEasyAuto-graded
    Dice Duel Wager: Expected Profit and Play Decision

    Compute the expected profit of a two-dice wager where ties favor the opponent, and decide whether a risk-neutral player should accept it.

    Math & Bit Manipulationprobabilityexpected-valuemathdice
  • Math & Bit ManipulationEasyAuto-graded
    Five Quick Probability Puzzles: Dice, Deck, Coins, Boxes

    Work out five small probability puzzles using symmetry, complements, counting and pigeonhole, and return the exact answers as fraction strings in order.

    Math & Bit Manipulationprobabilitycombinatoricspigeonholesymmetry
  • Math & Bit ManipulationEasyAuto-graded
    Sales Volume Needed to Hold Margin After a Menu Expansion

    Derive a closed-form sales volume that keeps profit margin unchanged after adding a second product with extra fixed costs, and reject unreachable targets.

    Math & Bit Manipulationmathalgebrabreak-evenprofit-margin
  • Math & Bit ManipulationEasyAuto-graded
    Factorial Trailing Zeros Without Building the Factorial

    Count the base-10 trailing zeros of n! by tallying factors of 5, never constructing the enormous factorial itself.

    Math & Bit Manipulationmathnumber-theoryfactorialcounting