DEV Community

Discussion on: Most Frequently asked Coding Questions

Collapse
ralphbrooks profile image
Ralph Brooks • Edited on

1. To swap 2 numbers without using an extra variable

The real insight here is that the solution presented could cause arithmetic overflow if the user entered sufficiently large inputs.

An interviewer would likely ask the question to see how fluent programmer is with java data types and to see good the programmer is at spotting potential errors.

Anyone with further questions like this can ask away. I am on Twitter at @whiteowled .