Loading...
Engaged Employer
How to swap two variables without a temp
Anonymous
a=a^b b=a^b a=a^b
a=a +b b=a - b a= a- b
What if the variable is big. like the max value of an integer. How do we do this without changing it to long (which is easy but obviously not the solution) use bitwise operations. a=3 b=4 a = a xor b xor a b = a xor b xor b
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 personalized job recommendations and updates by starting your searches.