Skip to content

Instantly share code, notes, and snippets.

@TilakMaddy
Created March 6, 2017 12:32
Show Gist options
  • Save TilakMaddy/87af1542162daed9792370decde8e3fd to your computer and use it in GitHub Desktop.
Save TilakMaddy/87af1542162daed9792370decde8e3fd to your computer and use it in GitHub Desktop.
XOR swapping algorithm
When you got two numbers ` a = 9 ` and ` b = 7 `
On performing
a ^= b
b ^= a
a ^= b
a abd b interchange values hence
print(a) // 7
print(b) // 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment