dsa2 min read
Make Sum Divisible by P — Prefix Mod + HashMap
Find the smallest subarray to remove so the remaining sum is divisible by p using prefix modular arithmetic.
Read →
webcoderspeed.com
4 articles
Find the smallest subarray to remove so the remaining sum is divisible by p using prefix modular arithmetic.
Count subarrays with sum divisible by k using prefix mod frequencies and the complement map pattern.
Solve systems of modular congruences with the Chinese Remainder Theorem. Fundamental for cryptography and competitive math.
Master modular arithmetic for competitive programming: binary exponentiation O(log n), modular inverse, and Chinese Remainder Theorem.