Bit Manipulation and Number Theory
Low-level operations used in optimization, hashing, subset processing, number theory, and algorithmic math tricks.
1.0 Bitwise Fundamentals
- Set/unset/check/toggle bits
- Shift operations
- Bit count and masks
2.0 XOR Patterns
- Single number (odd frequency)
- Pairwise XOR logic
- Missing number, duplicate detection
3.0 Bitmasking
- Subset generation
- Set cover and DP
- Bitwise DP state compression
4.0 Advanced Bit Tricks
- Brian Kernighan’s algorithm
- Lowest set bit
- Divide/multiply using shifts
5.0 Number Properties
- Prime number sieve
- Perfect squares and roots
- Palindromes, Armstrong, etc.
6.0 Modular Arithmetic
- Mod inverse
- Modulo multiplication/division
- Overflow prevention
7.0 GCD / LCM and Euclid’s Algorithm
- Standard GCD
- Extended Euclidean Algorithm
- LCM derivation
8.0 Combinatorics
- Factorials, nCr
- Pascal’s Triangle
- DP + combinatorics (unique paths, Catalan)
9.0 Base Conversions and Encodings
- Decimal ↔ Binary/Hex/Base62
- Excel column name ↔ Number
- Custom radix encoding/decoding