Loading...
Engaged Employer
Q: Given 2 numbers, without instantiating another variable, swap their values.
Anonymous
// assume a = 5, b = 2 a = a + b; // a = 7 , b = 2 b = a - b; // b = 5, a = 7 a = a -b; // a=2, b=5
with two variables X1 and X2: Swapping X1 to X2: X1*X2/(X1) = X2 Swapping X2 to X1: X2*X1/(X2) = X1
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.