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 .
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 .