BNP Paribas Interview Question

Swap 2 numbers without using temp variable. Why Testing.

Interview Answer

Anonymous

Oct 20, 2018

Let i=20, j=5 If (i>j) { i=i+j so now it is 25 j=i-j so now 20 i=i-j so now 5 Else reverse the variables

9