Recently, I was faced with a question that asked me to swap variable values without creating an extra variable.
i.e. A = 10, B = 20. How store 20 to A and 10 to B?
The solution is:
A = A + B #new value of A=30 B = B + A #new value of B=50 A = B - A #new value of A=20 B = B - 2 * A #new value of B=10
so A = 20 and B = 10
Does this algorithm have a known name?