Pattern
Bit Manipulation
Use bits when values act as small flags, or when and, or, xor and shifts replace loops. Xor cancels equal values, and a shift halves or doubles a number. These solutions usually take O(n) or O(bits) time with O(1) memory.
1. Single Numberarray · bit manipulation · xorEasy2. Number of 1 Bitsbit manipulation · math · countingEasy3. Counting Bitsbit manipulation · dynamic programming · arrayEasy4. Reverse Bitsbit manipulation · math · shiftsEasy5. Missing Numberarray · bit manipulation · xor · mathEasy6. Sum of Two Integersbit manipulation · math · twos complementMed.7. Reverse Integermath · overflowMed.