Sollicitatievraag bij Qualcomm

Swapping integers without using additional space

Antwoorden op sollicitatievragen

Anoniem

3 mei 2012

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

7

Anoniem

24 jul 2012

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

1

Anoniem

24 jul 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