Loading...
Engaged employer
Swapping integers without using additional space
Anonymous
a= a(xor)b, b= a(xor)b, a=a(xor)b
a = a + b; b = a - b; a = a - b;
Doesn't work if a and b are 32 bit integer. We might have over flow in a+b. a(xor)b will not have any overflow
Check out your Company Bowl for anonymous work chats.
Get actionable career advice tailored to you by joining more bowls.
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalised job recommendations and updates by starting your searches.