DEV Community

Discussion on: An Algorithm to Swap Two Variables Synchronously, Without Creating a Temporary Variable

Collapse
 
thecosmicsound1 profile image
thecosmicsound1

Interesting algo. Liked the creative approach - can be a good trick interview question. One case where it won't work, for example with ints in Java, a and b are very large ints and summing them would cause an overflow.