Skip to content

05. Maths

🧠 Maths Strategy

  1. Modular Arithmetic: \((a+b)\%m = ((a\%m) + (b\%m))\%m\). Always handle negative results: (a%m + m)%m.
  2. GCD: Use Euclidean Algorithm: gcd(a, b) = gcd(b, a%b).
  3. Primes: Use Sieve of Eratosthenes for finding primes up to \(N\).
  4. Permutations: Rank problems usually involve counting how many words start with smaller characters.

🟢 Ad-Hoc Logic & Puzzles

🟡 Modular Arithmetic

🟠 GCD (Greatest Common Divisor)

🔴 Primes & Factors

🟣 Combinatorics