Domanda di colloquio di Red Hat

How to swap two numbers without using temporary variable?

Risposte di colloquio

Anonimo

17 apr 2021

Swap(a, b){ a = a+b., b = a-b a = a-b } That works fine for numbers and characters only for complex types that will not work.

1

Anonimo

18 apr 2017

Provided addition/subtraction and XOR solution. But they were still looking for something else.

1