15 Swap Variables in Place without XOR |
No ratings yet!
The Sinking Island
frist A and B in 2 mnts A returns to give flash light in 1 mnts Now A and C in 5 mnts A returns to give flash light in 1 mnts frist A and D in 10 mnts A returns to give flash light in 1 mnts Total 19 mnts context |
The Sinking Island
sorry in last line of my answer A does not need come back it's a mistake of copy and paste of above line context |
Swap Variables in Place without XOR
solution: a=a+b; b=a-b; a=a-b; example: a=2,b=3 a=2+3; (a=5) b=5-3; (b=2) a=5-2; (a=3) now a=3,b=2 context |