Concepts5
⚙️AlgorithmIntermediate
Overflow Prevention Techniques
Integer overflow happens when a computed value exceeds the range of its type; in C++ this silently wraps for unsigned and is undefined for signed, so prevention is crucial.
#overflow prevention#long long#__int128+11
∑MathIntermediate
Linear Diophantine Equations
A linear Diophantine equation ax + by = c has integer solutions if and only if gcd(a, b) divides c.
#linear diophantine#extended euclidean algorithm#gcd+12
∑MathIntermediate
Chinese Remainder Theorem
The Chinese Remainder Theorem (CRT) reconstructs an integer from its remainders modulo pairwise coprime moduli and guarantees a unique answer modulo the product.
#chinese remainder theorem#crt#modular arithmetic+12
∑MathIntermediate
Extended Euclidean Algorithm
The Extended Euclidean Algorithm finds integers x and y such that ax + by = gcd(a, b) while also computing gcd(a, b).
#extended euclidean algorithm#bezout coefficients#gcd+12
∑MathIntermediate
GCD and Euclidean Algorithm
The greatest common divisor (gcd) of two integers is the largest integer that divides both without a remainder.
#gcd#euclidean algorithm#extended euclidean+12