# Single Number + Counting Bits
Two bit tricks from Module 2's Bit Manipulation lesson, back to back — currently zero mock coverage of this topic despite a full taught unit.
1. **Single Number:** given a list where every element appears twice except one, return that one element in O(N) time, O(1) space (XOR-cancellation: `a ^ a == 0`, `a ^ 0 == a`).
2. **Counting Bits:** given `n`, return a list `counts` where `counts[i]` is the number of 1-bits in `i`, for every `i` from `0` to `n` (Brian Kernighan-style DP-on-bits: `counts[i] = counts[i >> 1] + (i & 1)`).
Return both as a dict: `{'single_number': ..., 'counting_bits': [...]}`.
**Example:** `nums=[4,1,2,1,2], n=3` -> `{'single_number': 4, 'counting_bits': [0,1,1,2]}`.