dsa3 min read
Matrix Exponentiation: Fibonacci and Linear Recurrences
Solve linear recurrences like Fibonacci in O(log n) using matrix exponentiation. Essential for DP optimization on large n.
Read →
webcoderspeed.com
1276 articles
Solve linear recurrences like Fibonacci in O(log n) using matrix exponentiation. Essential for DP optimization on large n.
Explore digit manipulation, perfect/abundant numbers, Armstrong numbers, and common math interview patterns.
Compute combinations nCr efficiently with precomputed factorials, Pascal's triangle for small n, and Catalan numbers for tree/parenthesis counting.
Compute Euler's totient phi(n) for cryptography and modular inverse applications. Sieve variant for all values up to n.
Factor integers efficiently with trial division O(sqrt n), SPF sieve O(log n), and understand when each approach is optimal.