KatInterview

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

Math & Bit Manipulation Interview Problems

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

5969
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 31–60 of 184 results

  • Math & Bit ManipulationMediumAuto-graded
    Pair Growth by Adding One Coordinate to the Other

    Decide whether a positive integer pair can grow into a target pair by repeatedly adding one coordinate to the other, using reverse-step reasoning and Euclid-style reduction.

    Math & Bit Manipulationmatheuclidean-algorithmreverse-simulationnumber-theory
  • Math & Bit ManipulationEasyAuto-graded
    Shelf Stock Versus Random Demand in a Checkout Line

    Compute binomial probabilities that a limited stock covers random demand from a line of customers, both as at most M buyers and as exactly M buyers.

    Math & Bit Manipulationprobabilitybinomialcombinatoricsmath
  • Math & Bit ManipulationHardAuto-graded
    Stop or Pass: Optimal Play in a Two-Player Dice Duel

    Find the optimal accept/reject rule and the game value for a symmetric alternating-roll zero-sum game, using a stationary fixed-point equation.

    Math & Bit Manipulationexpected-valuegame-theoryoptimal-stoppingfixed-point
  • Math & Bit ManipulationMediumAuto-graded
    List Every Prime Not Exceeding a Limit

    Tests whether you can enumerate all primes up to a limit efficiently using a sieve instead of per-number primality tests, including the n below 2 edge case.

    Math & Bit Manipulationsieveprimesnumber-theoryarrays
  • Math & Bit ManipulationMediumAuto-graded
    Two-Segment Rider Model: Weekly Activity, Posterior, Forecast

    Compute three probabilities from a two-group mixture model: at-least-one-success over n days, a Bayesian posterior after all-success streaks, and a posterior predictive forecast.

    Math & Bit Manipulationprobabilitybayesmixture-modelcomplement-rule
  • Math & Bit ManipulationHardAuto-graded
    Count Substrings Rearrangeable into Palindromes

    Given a list of strings, count the number of contiguous substrings in each string whose characters can be permuted to form a valid palindrome.

    Math & Bit Manipulationbit-manipulationhash-tablestringsprefix-sum
  • Math & Bit ManipulationEasyAuto-graded
    Token Hop Around a Ring

    Compute where a token lands on a ring after k escalating hops, which tests spotting a prefix-sum closed form with modular arithmetic instead of simulating.

    Math & Bit Manipulationmathmodular-arithmeticsimulationclosed-form
  • Math & Bit ManipulationEasyAuto-graded
    Simple Interest Earned on a Short-Term Loan

    Compute the interest earned on a loan using a simple (non-compounding) annual percentage rate prorated over a number of months.

    Math & Bit Manipulationmathsimple-interestarithmeticfinance
  • Math & Bit ManipulationEasyAuto-graded
    Pricing Two Coin-Editing Tools in a Four-Coin Game

    Compute a baseline expected payoff and the fair prices of two coin-editing tools, using linearity of expectation, a parity invariant, and an absorbing-state argument.

    Math & Bit Manipulationprobabilityexpected-valueparity-invariantmarkov-chain
  • 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
  • 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
  • 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
  • Math & Bit ManipulationMediumAuto-graded
    Numerically Stable Focal Loss from Raw Scores

    Implement a class-weighted, focus-modulated binary cross-entropy directly from logits in pure Python, with stable math, input validation and sum/mean/none reductions.

    Math & Bit Manipulationnumerical-stabilitysigmoidloss-functionfloating-point
  • Math & Bit ManipulationEasyAuto-graded
    Matrix Power and Empirical Transitions for a Markov Chain

    Raise a row-stochastic matrix to a given power and build a row-normalized transition estimate from observed index pairs, leaving rows with no data as zeros.

    Math & Bit Manipulationmatrix-exponentiationmarkov-chainprobabilitycounting
  • Math & Bit ManipulationMediumAuto-graded
    Scale Factor-Model Portfolio Risk to a Yearly Figure

    Compute a portfolio's one-period variance from a factor model (exposures, factor covariance, specific variances), then scale it by periods per year and take the square root.

    Math & Bit Manipulationmatrixlinear-algebrafinancequadratic-form
  • Math & Bit ManipulationMediumAuto-graded
    Working Days Between Two Dates with a Closure List

    Count Monday-to-Friday days in an inclusive date range, skipping listed closure dates, using week arithmetic instead of day-by-day iteration.

    Math & Bit Manipulationdatescalendararithmeticsets
  • Math & Bit ManipulationMediumAuto-graded
    Smallest Primes Prefix: Build the First n Primes

    Generate the first n primes in ascending order, which tests sieve design with an upper bound derived from a count, plus handling of non-positive n.

    Math & Bit Manipulationprimessievenumber-theorymath
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Credit Card Portfolio Metrics and Partnership Break-Even

    Computes the annual net contribution per card, overall portfolio profit, and the minimum number of new accounts needed to cover a marketing campaign.

    Math & Bit Manipulationmathfinancial-modelingarithmetic
  • Math & Bit ManipulationEasyAuto-graded
    Single Row of the Binomial Triangle in Linear Space

    Compute one row of Pascal's triangle by index, using only space proportional to the row, via an in-place update or the multiplicative binomial recurrence.

    Math & Bit Manipulationpascal-trianglecombinatoricsdynamic-programmingarrays
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • Math & Bit ManipulationMediumAuto-graded
    Earliest Disc Overlap Among Unicycle-Driven Agents

    Simulate several disc-shaped agents with forward Euler unicycle motion and report the first time step at which any pair overlaps, with all pairs at that step.

    Math & Bit Manipulationsimulationgeometryfloating-pointpairs
  • Math & Bit ManipulationEasyAuto-graded
    Five Quick Quantitative Puzzles with Exact String Answers

    Solve five short arithmetic and algebra puzzles (units, compounding percentages, linear system, rate, series scaling) and return them in an exact string format.

    Math & Bit Manipulationmatharithmeticalgebraunit-conversion
  • Math & Bit ManipulationMediumAuto-graded
    Approximate a Square Root to the Nearest Tenth

    Compute the square root of a non-negative number without a built-in root function and return it rounded to one decimal place, using bisection or Newton's method.

    Math & Bit Manipulationbinary-searchnumerical-methodsfloating-pointmath