Loading...
Is this your company?
Brain Teaser: Swap two numbers without using a temporary third variable.
Anonymous
a = a+ b b = a - b a = a-b
I provided a solution involving using multiplication/division to store the information about both numbers in a single variable
Example: A=5, B=7 B=B*A^2=7*25 A=B/(A^2)=7*25/25=7 B=sqrt(B/A)=sqrt(7*25/7)=5
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.