Sollicitatievraag bij Bank of America

Swap two numbers while not using the temp variable.

Antwoorden op sollicitatievragen

Anoniem

27 sep 2013

a = a+b; b = a -b; a= a- b;

7

Anoniem

10 mrt 2013

using the XOR operator

3

Anoniem

4 feb 2015

a = a ^ b b = a ^ b a = a ^ b This will avoid over flows which might come in addition steps