Math Interview Questions

Number theory, combinatorics, and arithmetic tricks.

376 problems

#Title
7Reverse Integer
9Palindrome Number
12Integer to Roman
13Roman to Integer
29Divide Two Integers
50Pow(x, n)
60Permutation Sequence
65Valid Number
89Gray Code
166Fraction to Recurring Decimal
168Excel Sheet Column Title
171Excel Sheet Column Number
172Factorial Trailing Zeroes
223Rectangle Area
233Number of Digit One
248Strobogrammatic Number III
258Add Digits
263Ugly Number
292Nim Game
319Bulb Switcher
326Power of Three
335Self Crossing
338Counting Bits
343Integer Break
365Water and Jug Problem
372Super Pow
382Linked List Random Node
386Lexicographical Numbers
390Elimination Game
391Perfect Rectangle
398Random Pick Index
400Nth Digit
413Arithmetic Slices
423Reconstruct Original Digits from English
441Arranging Coins
453Minimum Moves to Equal Array Elements
458Poor Pigs
469Convex Polygon
470Implement Rand10() Using Rand7()
478Generate Random Point in a Circle
479Largest Palindrome Product
483Smallest Good Base
492Construct the Rectangle
497Random Point in Non-overlapping Rectangles
504Base 7
507Perfect Number
517Super Washing Machines
519Random Flip Matrix
528Random Pick with Weight
537Complex Number Multiplication
553Optimal Division
573Squirrel Simulation
592Fraction Addition and Subtraction
593Valid Square
598Range Addition II
625Minimum Factorization
628Maximum Product of Three Numbers
633Sum of Square Numbers
634Find the Derangement of An Array
640Solve the Equation
6514 Keys Keyboard
660Remove 9
672Bulb Switcher II
728Self Dividing Numbers
754Reach a Number
775Global and Local Inversions
779K-th Symbol in Grammar
780Reaching Points
781Rabbits in Forest
782Transform to Chessboard
789Escape The Ghosts
800Similar RGB Color
810Chalkboard XOR Game
812Largest Triangle Area
829Consecutive Numbers Sum
836Rectangle Overlap
858Mirror Reflection
866Prime Palindrome
883Projection Area of 3D Shapes
887Super Egg Drop
891Sum of Subsequence Widths
899Orderly Queue
902Numbers At Most N Given Digit Set
906Super Palindromes
907Sum of Subarray Minimums
908Smallest Range I
910Smallest Range II
914X of a Kind in a Deck of Cards
963Minimum Area Rectangle II
970Powerful Integers
972Equal Rational Numbers
1006Clumsy Factorial
1009Complement of Base 10 Integer
1012Numbers With Repeated Digits
1015Smallest Integer Divisible by K
1017Convert to Base -2
1025Divisor Game
1037Valid Boomerang
1041Robot Bounded In Circle
1067Digit Count in Range
1073Adding Two Negabinary Numbers
1079Letter Tile Possibilities
1088Confusing Number II
1103Distribute Candies to People
1118Number of Days in a Month
1121Divide Array Into Increasing Sequences
1128Number of Equivalent Domino Pairs
1131Maximum of Absolute Value Expression
1134Armstrong Number
1150Check If a Number Is Majority Element in a Sorted Array
1154Day of the Year
1157Online Majority Element In Subarray
1175Prime Arrangements
1185Day of the Week
1197Minimum Knight Moves
1217Play with Chips
1227Airplane Seat Assignment Probability
1232Check If It Is a Straight Line
1237Find Positive Integer Solution for a Given Equation
1238Circular Permutation in Binary Representation
1250Check If It Is a Good Array
1256Encode Number
1259Handshakes That Don't Cross
1266Minimum Time Visiting All Points
1276Number of Burgers with No Waste of Ingredients
1281Subtract the Product and Sum of Digits of an Integer
1300Sum of Mutated Array Closest to Target
1317Convert Integer to the Sum of Two No-Zero Integers
1323Maximum 69 Number
1330Reverse Subarray To Maximize Array Value
1344Angle Between Hands of a Clock
1359Count All Valid Pickup and Delivery Options
1360Number of Days Between Two Dates
1362Closest Divisors
1363Largest Multiple of Three
1390Four Divisors
1401Circle and Rectangle Overlapping
1415The k-th Lexicographical String of All Happy Strings of Length n
1442Count Triplets That Can Form Two Arrays of Equal XOR
1447Simplified Fractions
1486XOR Operation in an Array
1492The kth Factor of n
1497Check If Array Pairs Are Divisible by k
1512Number of Good Pairs
1513Number of Substrings With Only 1s
1525Number of Good Ways to Split a String
1537Get the Maximum Score
1551Minimum Operations to Make Array Equal
1611Minimum One Bit Operations to Make Integers Zero
1641Count Sorted Vowel Strings
1643Kth Smallest Instructions
1735Count Ways to Make Array With Product
1739Building Boxes
1744Can You Eat Your Favorite Candy on Your Favorite Day?
1753Maximum Score From Removing Stones
1776Car Fleet II
1780Check if Number is a Sum of Powers of Three
1806Minimum Number of Operations to Reinitialize a Permutation
1808Maximize Number of Nice Divisors
1812Determine Color of a Chessboard Square
1819Number of Different Subsequences GCDs
1822Sign of the Product of an Array
1823Find the Winner of the Circular Game
1828Queries on Number of Points Inside a Circle
1830Minimum Number of Operations to Make String Sorted
1835Find XOR Sum of All Pairs Bitwise AND
1837Sum of Digits in Base K
1860Incremental Memory Leak
1862Sum of Floored Pairs
1863Sum of All Subset XOR Totals
1884Egg Drop With 2 Eggs and N Floors
1904The Number of Full Rounds You Have Played
1916Count Ways to Build Rooms in an Ant Colony
1922Count Good Numbers
1945Sum of Digits of String After Convert
1952Three Divisors
1954Minimum Garden Perimeter to Collect Enough Apples
1969Minimum Non-Zero Product of the Array Elements
1979Find Greatest Common Divisor of Array
1980Find Unique Binary String
1982Find Array Given Subset Sums
2001Number of Pairs of Interchangeable Rectangles
2005Subtree Removal Game with Fibonacci Tree
2028Find Missing Observations
2029Stone Game IX
2063Vowels of All Substrings
2073Time Needed to Buy Tickets
2083Substrings That Begin and End With the Same Letter
2091Removing Minimum and Maximum From Array
2110Number of Smooth Descent Periods of a Stock
2117Abbreviating the Product of a Range
2119A Number After a Double Reversal
2125Number of Laser Beams in a Bank
2133Check if Every Row and Column Contains All Numbers
2145Count the Hidden Sequences
2148Count Elements With Strictly Smaller and Greater Elements
2152Minimum Number of Lines to Cover Points
2169Count Operations to Obtain Zero
2171Removing Minimum Number of Magic Beans
2176Count Equal and Divisible Pairs in an Array
2177Find Three Consecutive Integers That Sum to a Given Number
2180Count Integers With Even Digit Sum
2183Count Array Pairs Divisible by K
2198Number of Single Divisor Triplets
2217Find Palindrome With Fixed Length
2221Find Triangular Sum of an Array
2235Add Two Integers
2240Number of Ways to Buy Pens and Pencils
2244Minimum Rounds to Complete All Tasks
2249Count Lattice Points Inside a Circle
2262Total Appeal of A String
2280Minimum Lines to Represent a Line Chart
2310Sum of Numbers With Units Digit K
2338Count the Number of Ideal Arrays
2344Minimum Deletions to Make Array Divisible
2345Finding the Number of Visible Mountains
2376Count Special Integers
2396Strictly Palindromic Number
2400Number of Ways to Reach a Position After Exactly k Steps
2409Count Days Spent Together
2413Smallest Even Multiple
2427Number of Common Factors
2437Number of Valid Clock Times
2450Number of Distinct Binary Strings After Applying Operations
2455Average Value of Even Numbers That Are Divisible by Three
2468Split Message Based on Limit
2469Convert the Temperature
2481Minimum Cuts to Divide a Circle
2485Find the Pivot Integer
2514Count Anagrams
2520Count the Digits That Divide a Number
2521Distinct Prime Factors of Product of Array
2523Closest Prime Numbers in Range
2525Categorize Box According to Criteria
2539Count the Number of Good Subsequences
2543Check if Point Is Reachable
2544Alternating Digit Sum
2549Count Distinct Numbers on Board
2550Count Collisions of Monkeys on a Polygon
2562Find the Array Concatenation Value
2568Minimum Impossible OR
2579Count Total Number of Colored Cells
2582Pass the Pillow
2584Split the Array to Make Coprime Products
2614Prime In Diagonal
2651Calculate Delayed Arrival Time
2652Sum Multiples
2656Maximum Sum With Exactly K Elements
2731Movement of Robots
2739Total Distance Traveled
2749Minimum Operations to Make the Integer Zero
2750Ways to Split Array Into Good Subarrays
2761Prime Pairs With Target Sum
2778Sum of Squares of Special Elements
2780Minimum Index of a Valid Split
2802Find The K-th Lucky Number
2806Account Balance After Rounded Purchase
2833Furthest Point From Origin
2861Maximum Number of Alloys
2862Maximum Element-Sum of a Complete Subset of Indices
2894Divisible and Non-divisible Sums Difference
2898Maximum Linear Stock Score
2927Distribute Candies Among Children III
2928Distribute Candies Among Children I
2929Distribute Candies Among Children II
2930Number of Strings Which Can Be Rearranged to Contain Substring
2954Count the Number of Infection Sequences
2961Double Modular Exponentiation
2963Count the Number of Good Partitions
2979Most Expensive Item That Can Not Be Bought
2999Count the Number of Powerful Integers
3001Minimum Moves to Capture The Queen
3007Maximum Number That Sum of the Prices Is Less Than or Equal to K
3021Alice and Bob Playing Flower Game
3024Type of Triangle II
3032Count Numbers With Unique Digits II
3047Find the Largest Area of Square Inside Two Rectangles
3084Count Substrings Starting and Ending with Given Character
3091Apply Operations to Make Sum of Array Greater Than or Equal to k
3099Harshad Number
3102Minimize Manhattan Distances
3115Maximum Prime Difference
3128Right Triangles
3154Find Number of Ways to Reach the K-th Stair
3155Maximum Number of Upgradable Servers
3162Find the Number of Good Pairs I
3164Find the Number of Good Pairs II
3178Find the Child Who Has the Ball After K Seconds
3179Find the N-th Value After K Seconds
3183The Number of Ways to Make the Sum
3190Find Minimum Operations to Make All Elements Divisible by Three
3200Maximum Height of a Triangle
3222Find the Winning Player in Coin Game
3227Vowels Game in a String
3232Find if Digit Game Can Be Won
3247Number of Subsequences with Odd Sum
3250Find the Count of Monotonic Pairs I
3251Find the Count of Monotonic Pairs II
3270Find the Key of the Numbers
3272Find the Count of Good Integers
3274Check if Two Chessboard Squares Have the Same Color
3284Sum of Consecutive Subarrays
3299Sum of Consecutive Subsequences
3312Sorted GCD Pair Queries
3317Find the Number of Possible Ways for an Event
3326Minimum Division Operations to Make Array Non Decreasing
3339Find the Number of K-Even Arrays
3345Smallest Divisible Digit Product I
3348Smallest Divisible Digit Product II
3360Stone Removal Game
3395Subsequences with a Unique Middle Mode I
3405Count the Number of Arrays with K Matching Adjacent Elements
3411Maximum Subarray With Equal Products
3416Subsequences with a Unique Middle Mode II
3426Manhattan Distances of All Arrangements of Pieces
3428Maximum and Minimum Sums of at Most Size K Subsequences
3447Assign Elements to Groups with Constraints
3448Count Substrings Divisible By Last Digit
3461Check If Digits Are Equal in String After Operations I
3463Check If Digits Are Equal in String After Operations II
3470Permutations IV
3483Unique 3-Digit Even Numbers
3492Maximum Containers on a Ship
3512Minimum Operations to Make Array Sum Divisible by K
3513Number of Unique XOR Triplets I
3516Find Closest Person
3519Count Numbers with Non-Decreasing Digits
3556Sum of Largest Prime Substrings
3560Find Minimum Log Transportation Cost
3577Count the Number of Computer Unlocking Permutations
3588Find Maximum Area of a Triangle
3596Minimum Cost Path with Alternating Directions I
3602Hexadecimal and Hexatrigesimal Conversion
3618Split Array by Prime Indices
3621Number of Integers With Popcount-Depth Equal to K I
3622Check Divisibility by Digit Sum and Product
3623Count Number of Trapezoids I
3624Number of Integers With Popcount-Depth Equal to K II
3625Count Number of Trapezoids II
3648Minimum Sensors to Cover Grid
3658GCD of Odd and Even Sums
3659Partition Array Into K-Distinct Groups
3664Two-Letter Card Game
3666Minimum Operations to Equalize Binary String
3671Sum of Beautiful Subsequences
3677Count Binary Palindromic Numbers
3697Compute Decimal Representation
3726Remove Zeros in Decimal Representation
3731Find Missing Elements
3745Maximize Expression of Three Elements
3747Count Distinct Integers After Removing Zeros
3754Concatenate Non-Zero Digits and Multiply by Sum I
3765Complete Prime Number
3770Largest Prime from Consecutive Prime Sum
3783Mirror Distance of an Integer
3789Minimum Cost to Acquire Required Items
3790Smallest All-Ones Multiple
3798Largest Even Number
3800Minimum Cost to Make Two Binary Strings Equal
3817Good Indices in a Digit String
3821Find Nth Smallest Integer With K One Bits
3855Sum of K-Digit Numbers in a Range
3857Minimum Cost to Split into Ones
3870Count Commas in Range
3871Count Commas in Range II
3881Direction Assignments with Exactly K Visible People
3895Count Digit Appearances
3896Count Digit Appearances
3899Angles of a Triangle
3908Valid Digit Number
3927Minimize Array Sum Using Divisible Replacements
3954Sum of Compatible Numbers in Range I
3958Minimum Cost to Split into Ones II
3959Check Good Integer
3984Divisible Game
3987Minimum Total Cost to Process All Elements