Demonstrates two elegant constant-space approaches: XOR and math (Gauss's formula). Both avoid sorting or extra space.
Enable JavaScript for the full StreamPrep guide.