Pergunta de entrevista da empresa Bank of America

Swap two numbers while not using the temp variable.

Respostas da entrevista

Sigiloso

27 de set. de 2013

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

7

Sigiloso

10 de mar. de 2013

using the XOR operator

3

Sigiloso

4 de fev. de 2015

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