Mathematics
This plan collects problems where the answer comes from a formula or a counting argument rather than a data structure: primes and GCDs, counting arrangements modulo a large prime, expected values, and deciding who wins a two-player game.
Its seven chapters are number theory, combinatorics, probability and expected value, game theory, computational geometry, randomized algorithms, and miscellaneous math. Take it when problems keep stalling on the math step rather than the code.
Want company while you work through this list? Sign in, open the study room, and your heroine will bring you the problems one at a time.
I. Number Theory
§1.1 Primality Testing
§1.2 Sieve of Eratosthenes
§1.3 Prime Factorization
§1.4 Factorizing Factorials
| Problem | Rating |
|---|---|
| 172. Factorial Trailing Zeroes | Unrated |
§1.5 Divisors
§1.6 Greatest Common Divisor (GCD)
§1.7 Least Common Multiple (LCM)
| Problem | Rating |
|---|---|
| 2413. Smallest Even Multiple | 1145 |
| 858. Mirror Reflection | 1881 |
| 2470. Number of Subarrays with Lcm Equal to K | Unrated |
§1.8 Coprimality
| Problem | Rating |
|---|---|
| 1447. Simplified Fractions | 1400 |
| 1766. Tree of Coprimes | 2232 |
| 3411. Maximum Subarray with Equal Products | 2300 |
§1.9 Modular Congruence
| Problem | Rating |
|---|---|
| 2453. Destroy Sequential Targets | 1762 |
| 2598. Smallest Missing Non Negative Integer After Operations | 1846 |
§1.10 Floor Division Blocks
| Problem | Rating |
|---|---|
| 1925. Count Square Sum Triples | Unrated |
§1.11 Miscellaneous
| Problem | Rating |
|---|---|
| 1018. Binary Prefix Divisible by 5 | 1376 |
| 326. Power of Three | Unrated |
| 372. Super Pow | Unrated |
| 1015. Smallest Integer Divisible by K | Unrated |
| 633. Sum of Square Numbers | Unrated |
| 2240. Number of Ways to Buy Pens AND Pencils | Unrated |
II. Combinatorics
§2.1 Rule of Product
§2.2 Combinatorial Counting
§2.3 Balls into Boxes
| Problem | Rating |
|---|---|
| 1641. Count Sorted Vowel Strings | 1519 |
| 1621. Number of Sets of K Non Overlapping Line Segments | 2198 |
| 1735. Count Ways to Make Array with Product | 2500 |
| 2338. Count the Number of Ideal Arrays | 2615 |
§2.4 Inclusion-Exclusion Principle
| Problem | Rating |
|---|---|
| 2652. Sum Multiples | Unrated |
| 2929. Distribute Candies Among Children II | Unrated |
§2.5 Contribution Method
III. Probability & Expected Value
III. Probability & Expected Value
| Problem | Rating |
|---|---|
| 1227. Airplane Seat Assignment Probability | Unrated |
IV. Game Theory
IV. Game Theory
| Problem | Rating |
|---|---|
| 292. Nim Game | Unrated |
| 3227. Vowels Game in a String | 1452 |
| 2038. Remove Colored Pieces If Both Neighbors Are the Same Color | 1468 |
| 1686. Stone Game VI | 2001 |
| 1927. Sum Game | 2005 |
| 2029. Stone Game IX | 2277 |
V. Computational Geometry
§5.1 Points and Lines
| Problem | Rating |
|---|---|
| 1232. Check If It Is a Straight Line | 1247 |
| 2280. Minimum Lines to Represent a Line Chart | 1681 |
| 1610. Maximum Number of Visible Points | 2147 |
§5.2 Circles
| Problem | Rating |
|---|---|
| 1401. Circle AND Rectangle Overlapping | 1709 |
| 1453. Maximum Number of Darts Inside of a Circular Dartboard | 2202 |
§5.3 Rectangles and Polygons
| Problem | Rating |
|---|---|
| 836. Rectangle Overlap | 1443 |
| 223. Rectangle Area | Unrated |
| 593. Valid Square | Unrated |
| 939. Minimum Area Rectangle | 1752 |
| 963. Minimum Area Rectangle II | 1991 |
| 3625. Count Number of Trapezoids II | 2643 |
§5.4 Convex Hull
| Problem | Rating |
|---|---|
| 587. Erect the Fence | Unrated |
| 812. Largest Triangle Area | Unrated |
VI. Randomized Algorithms
§6.1 Random Numbers
| Problem | Rating |
|---|---|
| 398. Random Pick Index | Unrated |
| 382. Linked List Random Node | Unrated |
| 384. Shuffle an Array | Unrated |
| 470. Implement Rand10 Using Rand7 | Unrated |
| 528. Random Pick with Weight | Unrated |
| 710. Random Pick with Blacklist | Unrated |
| 478. Generate Random Point in a Circle | Unrated |
| 497. Random Point in Non Overlapping Rectangles | Unrated |
| 519. Random Flip Matrix | Unrated |
| 380. Insert Delete Getrandom O1 | Unrated |
| 381. Insert Delete Getrandom O1 Duplicates Allowed | Unrated |
§6.2 Randomization Techniques
VII. Miscellaneous Mathematics
§7.1 Palindromic Numbers
§7.2 Integer Partition
| Problem | Rating |
|---|---|
| 343. Integer Break | Unrated |
| 1808. Maximize Number of Nice Divisors | 2070 |
§7.3 Manhattan Distance
| Problem | Rating |
|---|---|
| 3443. Maximum Manhattan Distance After K Changes | 1856 |
| 1131. Maximum of Absolute Value Expression | 2059 |
| 3102. Minimize Manhattan Distances | 2216 |
| 1330. Reverse Subarray to Maximize Array Value | 2482 |
§7.4 Polynomials
| Problem | Rating |
|---|---|
| 611. Valid Triangle Number | Unrated |
| 923. 3sum with Multiplicity | Unrated |
| 835. Image Overlap | Unrated |
§7.7 Miscellaneous
It sits seventh on Track 1, between Greedy Algorithms and Strings & Automata, and since the route never locks a plan you can jump here from the full catalog.
Ratings come from zerotrac's LeetCode contest ratings. Some problems have no zerotrac rating and are marked Unrated.
Open the study room