Intermediate Math Problems for Coding Interviews
316 intermediate Math problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 316 intermediate and 0 advanced. The companies that ask them most often are Amazon, Google, Bloomberg, Meta.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Decode Ways (Intermediate)
- Happy Number (Intermediate)
- Count and Say (Intermediate)
- Integer to Roman (Intermediate)
- Count Primes (Intermediate)
- Reverse Integer (Intermediate)
- Sum of Two Squares (Intermediate)
- Greatest Common Divisor of Strings (Intermediate)
- Count Good Digit Strings (Intermediate)
- Count Substrings of Ones (Intermediate)
- Minimum Flips to Alternate Digits (Intermediate)
- Maximum Swap of Digits (Intermediate)
- Remove K Digits to Get the Smallest Number (Intermediate)
- Prime Factorization (Intermediate)
- Minimum Knight Moves (Intermediate)
- Count Numbers With Unique Digits (Intermediate)
- Count Multiples in a Range (Intermediate)
- Smallest Number From Pattern (Intermediate)
- Count Walks With Exact Length (Intermediate)
- Coin Change Ways (Intermediate)
- Count Good Digit Strings (Intermediate)
- Unique Paths With Obstacles (Intermediate)
- Count Ways to Tile Board (Intermediate)
- Prime Factorization Queries (Intermediate)
- Median of Sliding Windows (Intermediate)
- Count Perfect Matchings (Intermediate)
- Count Divisible Numbers in Range (Intermediate)
- Root-to-Leaf Number Sum (Intermediate)
- Count Ways to Form Target From Columns (Intermediate)
- Median of Row-Wise Sorted Matrix (Intermediate)
- Minimum Number of Perfect Squares (Intermediate)
- Longest Increasing Subsequence Count (Intermediate)
- Egg Drop Minimum Attempts (Intermediate)
- Decode Ways With Wildcards (Intermediate)
- Cryptarithm Solver (Intermediate)
- SAT Assignment (Intermediate)
- Linear Recurrence Queries (Intermediate)
- Add Two Numbers as Linked Lists (Intermediate)
- Double a Number Stored in a Linked List (Intermediate)
- Pseudo-Palindromic Root-to-Leaf Paths (Intermediate)
- Add Two Numbers Forward Order (Intermediate)
- Reverse Nodes in Even Length Groups (Intermediate)
- Multiply Two Numbers as Linked Lists (Intermediate)
- Even Odd Tree (Intermediate)
- Maximum Product of Split Binary Tree (Intermediate)
- Reverse Odd Levels of Perfect Tree (Intermediate)
- Binary Tree Coloring Game (Intermediate)
- Count Full Binary Trees (Intermediate)
- Open the Lock (Intermediate)
- Count Paths in a DAG (Intermediate)
- Combination Sum IV (Intermediate)
- Count Vowel Permutations (Intermediate)
- Knight Dialer (Intermediate)
- Paint Fence Ways (Intermediate)
- Out of Boundary Paths (Intermediate)
- Minimum Beautiful Substrings (Intermediate)
- Count Palindromic Partitions (Intermediate)
- Guess Number Game Cost (Intermediate)
- Paint N x 3 Grid (Intermediate)
- Count Ways to Distribute Candies (Intermediate)
- Digit Sum in Range Count (Intermediate)
- Integer Replacement (Intermediate)
- Ways to Split Array Into Good Subarrays (Intermediate)
- Count Number of Texts (Intermediate)
- Count Ways to Build Good Strings (Intermediate)
- Number of Ways to Select Buildings (Intermediate)
- String to Integer (Intermediate)
- Validate IP Address (Intermediate)
- Sum of Subarray Ranges (Intermediate)
- Ugly Number II (Intermediate)
- Super Ugly Number (Intermediate)
- Maximal Score After K Operations (Intermediate)
- Valid Sudoku (Intermediate)
- Bulls and Cows (Intermediate)
- Subsequences With Min Plus Max At Most Target (Intermediate)
- Bag of Tokens (Intermediate)
- Smallest Divisor Given a Threshold (Intermediate)
- Total Hamming Distance (Intermediate)
- Divide Two Integers (Intermediate)
- Convert to Base -2 (Intermediate)
Related
Frequently asked questions
How do I get good at math problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run math problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.