KatInterview

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

Math & Bit Manipulation Interview Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 151–180 of 217 results

  • Math & Bit ManipulationMediumModel answer
    Bounded Robot Path Under Infinite Command Repeats

    Simulate one pass of a compressed command string, then decide whether infinitely repeating it keeps the robot inside a finite region, even with obstacles.

    Math & Bit Manipulationsimulationcycle-detectiongeometrystate-machine
  • Math & Bit ManipulationMediumAuto-graded
    Frequency Peaks and Prime Extraction

    Tests frequency counting with tie-aware mode detection and prime identification via sieve, including edge cases for unique values and non-prime inputs.

    Math & Bit Manipulationhash-mapsieve-of-eratosthenesfrequency-counting
  • Math & Bit ManipulationHardModel answer
    Do Two Walkers Ever Share the Same Tile?

    Determine if two entities moving on an infinite 2D grid ever occupy the same cell at the same integer time step.

    Math & Bit Manipulationgeometrysimulationinterval-arithmetictwo-pointers
  • Math & Bit ManipulationMediumAuto-graded
    Decode a Mixed-Radix Positional Number

    Tests the ability to convert a number represented in a variable base-per-digit (mixed-radix) system back to its standard base-10 integer value.

    Math & Bit Manipulationmathbase conversionnumber theory
  • Math & Bit ManipulationMediumModel answer
    Four Labeled Boxes, Only One Label Tells the Truth

    Use a complementary pair of quantified statements to pin down which label is false, then read off the forced conclusion.

    Math & Bit Manipulationlogicpropositional-reasoningquantifiersconstraint-satisfaction
  • Math & Bit ManipulationEasyAuto-graded
    Four Colleagues in a Row: Recover the Exact Standing Order

    Tests constraint satisfaction and logical deduction by finding the unique left-to-right arrangement of four people from four positional clues.

    Math & Bit Manipulationlogicconstraint-satisfactionbrute-forcepermutations
  • Math & Bit ManipulationMediumAuto-graded
    Overflow-Safe Power with a Custom Modular Multiplier

    Tests whether a candidate can build exponentiation from scratch using only 64-bit-safe addition and multiplication under an arbitrary modulus.

    Math & Bit Manipulationmodular arithmeticbit manipulationexponentiation by squaring
  • Math & Bit ManipulationMediumAuto-graded
    Four Numbers, One Target: Arithmetic Reachability

    Tests combinatorial search over arithmetic expressions, exact rational arithmetic, and division-by-zero handling to decide if four numbers can combine to a target.

    Math & Bit Manipulationbacktrackingrecursionmath
  • Math & Bit ManipulationEasyAuto-graded
    Steady-State Junction Temperature With and Without Heatsink

    Compute a component's junction temperature from power dissipation and series thermal resistances, both before and after adding a heatsink.

    Math & Bit Manipulationthermal-modelingarithmeticembedded-systemssteady-state
  • Math & Bit ManipulationMediumModel answer
    Build a [0,1) Sampler from Fair Coin Flips

    Design an algorithm that uses a fair-bit source to produce a number uniformly distributed on [0,1), and analyze its error and cost.

    Math & Bit Manipulationprobabilityrandomized-algorithmsbit-manipulationfloating-point
  • Math & Bit ManipulationMediumModel answer
    Integer Sequence Rule Inference and Next-Term Prediction

    Design a systematic program that detects the governing rule of an integer sequence and predicts the next k terms, ranked by plausibility.

    Math & Bit Manipulationpattern-recognitionmodel-selectionfinite-differencesrecurrences
  • Math & Bit ManipulationEasyAuto-graded
    Truth-Tellers and Liars: Deduce Two Island Identities

    Tests systematic logical deduction by resolving a two-person truth-teller/liar puzzle through exhaustive case analysis.

    Math & Bit Manipulationlogiccase-analysismath
  • Math & Bit ManipulationMediumAuto-graded
    Reroll Game Expected Value and Break-Even Cost

    Tests probability recursion, expected value with random stopping times, and cost-benefit analysis in a sequential game.

    Math & Bit Manipulationprobabilityexpected-valuerecursion
  • Math & Bit ManipulationMediumAuto-graded
    Optimal Ball Distribution for Maximum Joint Red Probability

    Tests ability to formulate and optimize a probability function over discrete allocations with boundary analysis.

    Math & Bit Manipulationprobabilityoptimizationmath
  • Math & Bit ManipulationEasyAuto-graded
    Calculate QR Campaign Funnel Metrics

    Tests understanding of multi-stage conversion funnels by computing metrics at each step given input rates.

    Math & Bit Manipulationmathfunnel-analysisconversions
  • Math & Bit ManipulationHardAuto-graded
    Compute Complexity Bounds for Dense Matrix Operations

    Tests asymptotic analysis skills by deriving time and space complexity for dense matrix multiplication with multiple dimensions.

    Math & Bit Manipulationcomplexity-analysislinear-algebrabig-o
  • Math & Bit ManipulationMediumModel answer
    Most Negative 8-bit Value with Exactly Three Set Bits

    Find the smallest two's-complement signed 8-bit integer whose binary representation contains exactly three 1 bits.

    Math & Bit Manipulationbit-manipulationtwo's-complementsigned-integers
  • Math & Bit ManipulationMediumAuto-graded
    Balance Integer Values to Minimize Spread

    Tests understanding of integer division, remainder distribution, and handling negative numbers in a fairness optimization problem.

    Math & Bit Manipulationmathgreedydivisionedge-cases
  • Math & Bit ManipulationMediumModel answer
    Compute Sum of Divisible Integers Using Inclusion-Exclusion

    Find the total of all positive integers below n divisible by 3, 5, or 7 in constant time using arithmetic series and inclusion-exclusion.

    Math & Bit Manipulationinclusion-exclusionarithmetic-seriesnumber-theory
  • Math & Bit ManipulationMediumAuto-graded
    Count Subsequences With Uniform Letter Frequency

    Tests combinatorics, modular arithmetic, and frequency grouping by counting index-distinct subsequences where every included letter appears the same number of times.

    Math & Bit Manipulationcombinatoricsmodular arithmeticfrequency counting
  • Math & Bit ManipulationMediumAuto-graded
    Longest Non-Overlapping Character Chain

    Tests backtracking or bitmask optimization to select a subset of strings whose combined characters are all distinct.

    Math & Bit Manipulationbacktrackingbit-manipulationrecursion
  • Math & Bit ManipulationMediumAuto-graded
    Observer Simulation and Manual Integer Conversion

    Tests event-driven simulation optimization and precise numeric string formatting including signed 32-bit boundary handling.

    Math & Bit Manipulationsimulationmathstring-manipulation
  • Math & Bit ManipulationMediumAuto-graded
    Count Days Between Two Dates

    Tests efficient calendar arithmetic by computing date intervals without iteration, requiring leap year logic and modular reasoning.

    Math & Bit Manipulationmathcalendarmodular-arithmetic
  • Math & Bit ManipulationMediumAuto-graded
    Calculate Day Count Between Two Dates

    Tests understanding of calendar arithmetic including leap year logic, month lengths, and converting dates to a numeric representation.

    Math & Bit Manipulationmathimplementationdate-arithmetic
  • Math & Bit ManipulationEasyAuto-graded
    Calculate Population Variance Using Welford's Method

    Tests ability to implement numerically stable variance computation with single-pass streaming aggregation and handling of floating-point precision issues.

    Math & Bit Manipulationmathstatisticsnumerical-stabilitystreaming
  • Math & Bit ManipulationHardAuto-graded
    Splitting Tokens: Will a Bucket Ever Run Dry?

    Tests whether a candidate can identify a modular-arithmetic invariant to avoid simulating an exponentially long process.

    Math & Bit Manipulationmathbit-manipulationnumber-theory
  • Math & Bit ManipulationMediumModel answer
    Infer Numeric Pattern and Identify Corrupted Element

    Determine which mathematical pattern a sequence follows, detect if one value is wrong, and predict the next term.

    Math & Bit Manipulationsequencespattern-recognitionedge-cases
  • Math & Bit ManipulationMediumAuto-graded
    Parse Mixed-Endian Binary Protocol Fields

    Tests byte-level manipulation to extract little-endian and big-endian integers from a raw byte buffer without relying on architecture-specific memory layout.

    Math & Bit Manipulationbit-manipulationbytesendianness
  • Math & Bit ManipulationMediumAuto-graded
    Match IP Address to Network Block

    Tests bitwise operations on IPv4 addresses, CIDR prefix matching, and linear search with early termination.

    Math & Bit Manipulationbit-manipulationipv4networkinglinear-search
  • Math & Bit ManipulationMediumAuto-graded
    Calculate Emergency Braking Distance and Decision

    Tests understanding of kinematic equations, motion physics, and numerical reasoning to determine whether a vehicle can stop in time given speed, obstacle distance, deceleration, and reaction delay.

    Math & Bit Manipulationphysicskinematicsnumerical-reasoning