Jump Trading interview question

Swap two variables without using a temp.

Interview Answers

Anonymous

19 Sept 2012

in c/c++: x^=y^=x^=y;

4

Anonymous

11 Feb 2016

a= a*b; b = a/b; a = a/b;

2

Anonymous

24 Nov 2017

+/- is correct even with overflow

Anonymous

8 Nov 2012

You don't want to use +-/* as you might face under/overflow.

Anonymous

11 Apr 2012

Can be done using adding/subtracting, multiply/divide, xor.