Frage im Vorstellungsgespräch bei Qualcomm

Swapping integers without using additional space

Antworten zu Vorstellungsgespräch

Anonym

3. Mai 2012

a= a(xor)b, b= a(xor)b, a=a(xor)b

7

Anonym

24. Juli 2012

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

1

Anonym

24. Juli 2012

Doesn't work if a and b are 32 bit integer. We might have over flow in a+b. a(xor)b will not have any overflow

1