Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
XOR all elements together in a single pass. Since XOR is self-inverse (a ^ a = 0) and commutative, every duplicate pair cancels out, leaving only the unique element.
XOR of a number with itself is zero, and XOR with zero is the number itself, so all paired duplicates vanish and the lone element remains.
Updated Feb 2026