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
273
Added today

Showing 61–90 of 217 results

  • 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
  • Math & Bit ManipulationEasyAuto-graded
    Possible Subspace Intersection Dimensions

    Computes all valid integer dimensions for the intersection of two vector subspaces given ambient and subspace dimensions.

    Math & Bit Manipulationmathlinear-algebra
  • Math & Bit ManipulationMediumAuto-graded
    Firewall Rule Resolver with Longest-Prefix Priority

    Resolve an IPv4 address against CIDR allow/deny rules using longest-prefix precedence, later-rule tie-breaking, and a default of deny, via bitmask matching.

    Math & Bit Manipulationbit-manipulationcidripv4simulation
  • Math & Bit ManipulationMediumAuto-graded
    Enumerate Every Factor of a Large Integer in Sorted Order

    Produce all positive factors of an integer up to 10^12 in increasing order, handling perfect squares and large primes, and consider approaches faster than a square-root scan.

    Math & Bit Manipulationnumber-theorydivisorsfactorizationsquare-root
  • Math & Bit ManipulationMediumModel answer
    Spot Hidden Differences Between Two Array Routines

    Decide whether two array-processing routines behave identically under 32-bit integer rules, find a smallest counterexample if not, and design tests that expose subtle divergences.

    Math & Bit Manipulationprogram-equivalenceinteger-overflowproperty-based-testingdifferential-testing
  • Math & Bit ManipulationEasyModel answer
    Two Islanders, One Accusation: Which Role Pairs Work?

    One islander accuses the other of always lying. Test all four role pairings and decide which ones are logically possible.

    Math & Bit Manipulationlogicpuzzlecase-analysisknights-and-knaves
  • Math & Bit ManipulationEasyAuto-graded
    Is This Dice Wager Worth Playing? Expected Value Check

    Count outcomes of a two-dice contest where ties favor the house, compute the expected profit per round, and decide whether a risk-neutral player should take the bet.

    Math & Bit Manipulationprobabilityexpected-valuemathcounting
  • Math & Bit ManipulationEasyAuto-graded
    Gaussian Fit Summary: Mean and Two Variance Estimates

    Compute the sample mean, the divide-by-n variance, and the divide-by-(n-1) variance from a list of numbers, tying MLE for a normal model to Bessel's correction.

    Math & Bit Manipulationstatisticsmatharraysfloating-point
  • Math & Bit ManipulationMediumAuto-graded
    Simulate IPv4 CIDR Block Iterator

    Parse IPv4 CIDR blocks and simulate step-by-step traversal over all IP addresses in the subnet range.

    Math & Bit Manipulationbit-manipulationstringsdesignmath
  • Math & Bit ManipulationMediumAuto-graded
    Floor of a Square Root Without Built-ins

    Compute the largest integer whose square does not exceed a non-negative integer, without using built-in roots or powers, using monotonic search or an iterative refinement.

    Math & Bit Manipulationbinary-searchmathnewton-methodinteger-arithmetic
  • Math & Bit ManipulationMediumAuto-graded
    Gambler's Ruin: Chance of Hitting the Goal Before Bust

    Compute the probability that a biased ±1 random walk reaches a target balance before hitting zero, using a recurrence and closed form with careful edge cases.

    Math & Bit Manipulationprobabilitygambler's ruinrecurrencerandom walk
  • Math & Bit ManipulationMediumAuto-graded
    Calculate Minimal Clock Hand Separation Angle

    Parse 24-hour timestamp strings (including optional seconds and milliseconds) and calculate the minor angle between analog clock hands.

    Math & Bit Manipulationmathstringsgeometry
  • Math & Bit ManipulationMediumAuto-graded
    Maximum Area of a Rotated Rectangle

    Find the largest surface area of any rectangle formed by four vertices chosen from a given set of 2D points.

    Math & Bit Manipulationmathgeometryhashingarrays
  • Math & Bit ManipulationMediumModel answer
    Simulate 2048 Mechanics and Pack Grid into 64-Bit Integer

    Simulate grid sliding and merging rules for the game 2048, and design a bit-packing scheme to compress the 4x4 state into a single 64-bit integer.

    Math & Bit Manipulationbit-manipulationarrayssimulationmatrix
  • Math & Bit ManipulationEasyAuto-graded
    Min Comparisons to Determine Top Two Elements

    Calculate the theoretical minimum number of comparisons needed in the worst case to locate both the largest and second-largest elements among N items.

    Math & Bit Manipulationmathsortingalgorithms
  • Math & Bit ManipulationEasyAuto-graded
    Expected Transit Wait Time with Stochastic Delays

    Computes the expected waiting time for a passenger arriving at a random moment at a stop with probabilistic bus delays.

    Math & Bit Manipulationmathprobabilitystatisticsexpected-value
  • Math & Bit ManipulationMediumAuto-graded
    Optimal Warehouse Placement to Minimize Total Delivery Distance

    Find the minimum cumulative Manhattan distance from a single target point to all target locations in a 2D grid.

    Math & Bit Manipulationarraysmathsortinggrid
  • Math & Bit ManipulationEasyAuto-graded
    Exact Binomial Probability of Coin Flips

    Calculates the exact binomial probability of obtaining a specific number of heads across a series of fair coin tosses.

    Math & Bit Manipulationmathprobabilitycombinatorics
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Progressive Income Tax in Cents

    Determine progressive income tax in cents given bracket thresholds and percentage rates using integer math.

    Math & Bit Manipulationmatharrayssimulation
  • Math & Bit ManipulationMediumAuto-graded
    Aggressive Wagering: Chance of Hitting the Goal Before Going Broke

    Model a state-dependent betting strategy as a Markov chain and solve absorption probabilities, including cycles, via a linear system.

    Math & Bit Manipulationprobabilitymarkov-chainlinear-algebragaussian-elimination
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Product Mix Profitability Metrics

    Computes baseline and mix-shifted unit profit averages, per-unit margin delta, and overall impact on profit given total volume.

    Math & Bit Manipulationmatharrays
  • Math & Bit ManipulationEasyModel answer
    Circle Point Generation, Strict Monotonic Run, and Histogram Interpolation

    Solve three foundational tasks: uniform random sampling within a disk, tracking the longest strictly increasing contiguous array, and computing bucketed percentiles.

    Math & Bit Manipulationsamplingarraysinterpolationmath