P\S\L Group interview question

Swap the value of two variables without any third variable.

Interview Answer

Anonymous

9 Aug 2018

Imagine x=10 and Y=6. Compare which is bigger. Then iterate x-y=4 times adding one to small number and substracting one to the big number. So x-4=6 and y+4=10.