Your question is Swap Integers Without Temp. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Pega Platform rule processing may need to exchange two integer values while evaluating a lightweight algorithmic step. Implement a function that swaps two integers without declaring or using an explicit temporary variable.
The function must return the values in reversed order. Do not rely on global state, input mutation, string conversion, or arithmetic operations that could overflow in fixed-width languages.
Implement swap_integers(a, b):
a and b.(b, a).Python tuple assignment is allowed. The returned values must be correct when the integers are equal, negative, zero, or very large.
def swap_integers(a, b):