Algorithm · Oracle · Easy
You are given two integer variables, a and b. Exchange their contents so that the original value of a ends up in b and the original value of b ends up in a. You are not allowed to create a third variable at any stage of the exchange. Example 1: Explanation: a becomes the previous value of b, and b becomes the previous value of a. Example 2: Example 3: Constraints: a and b are signed 32-bit integers. Defining or using a separate temporary variable is not permitted. Expected…
Checking your access…