DEV Community

Discussion on: How can you swap two variables without using a third?

Collapse
 
almostconverge profile image
Peter Ellis • Edited

This is a nice puzzle to work out.

Another interesting(?) lesson is that beyond saving space, once this solution used to really be faster than the "naive method", but on modern CPUs that is no longer the case.