Pergunta de entrevista da empresa Red Hat

How to swap two numbers without using temporary variable?

Respostas da entrevista

Sigiloso

17 de abr. de 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

Sigiloso

18 de abr. de 2017

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

1