KatInterview

Topic

Math & Bit Manipulation interview problems

Number theory, combinatorics and bit tricks. 217 original problems, each with hidden test cases you can run in the browser.

Problems217

84 easy112 medium21 hard

Showing 151–180 of 217 results

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

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

    Auto-gradedhash-mapsieve-of-eratosthenesfrequency-counting
  • Determine if two entities moving on an infinite 2D grid ever occupy the same cell at the same integer time step.

    Model answergeometrysimulationinterval-arithmetictwo-pointers
  • 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.

    Auto-gradedmathbase conversionnumber theory
  • Use a complementary pair of quantified statements to pin down which label is false, then read off the forced conclusion.

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

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

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

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

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

    Model answerprobabilityrandomized-algorithmsbit-manipulationfloating-point
  • Design a systematic program that detects the governing rule of an integer sequence and predicts the next k terms, ranked by plausibility.

    Model answerpattern-recognitionmodel-selectionfinite-differencesrecurrences
  • Tests systematic logical deduction by resolving a two-person truth-teller/liar puzzle through exhaustive case analysis.

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

    Auto-gradedprobabilityexpected-valuerecursion
  • Tests ability to formulate and optimize a probability function over discrete allocations with boundary analysis.

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

    Auto-gradedmathfunnel-analysisconversions
  • Tests asymptotic analysis skills by deriving time and space complexity for dense matrix multiplication with multiple dimensions.

    Auto-gradedcomplexity-analysislinear-algebrabig-o
  • Find the smallest two's-complement signed 8-bit integer whose binary representation contains exactly three 1 bits.

    Model answerbit-manipulationtwo's-complementsigned-integers
  • Tests understanding of integer division, remainder distribution, and handling negative numbers in a fairness optimization problem.

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

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

    Auto-gradedcombinatoricsmodular arithmeticfrequency counting
  • Tests backtracking or bitmask optimization to select a subset of strings whose combined characters are all distinct.

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

    Auto-gradedsimulationmathstring-manipulation
  • Tests efficient calendar arithmetic by computing date intervals without iteration, requiring leap year logic and modular reasoning.

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

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

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

    Auto-gradedmathbit-manipulationnumber-theory
  • Determine which mathematical pattern a sequence follows, detect if one value is wrong, and predict the next term.

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

    Auto-gradedbit-manipulationbytesendianness
  • Tests bitwise operations on IPv4 addresses, CIDR prefix matching, and linear search with early termination.

    Auto-gradedbit-manipulationipv4networkinglinear-search
  • 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.

    Auto-gradedphysicskinematicsnumerical-reasoning

More topics