Pergunta de entrevista da empresa Colgate-Palmolive

How do you swap two integer variables without creating a temporary variable?

Respostas da entrevista

Sigiloso

23 de set. de 2017

int x = 10; int y = 12; x = x+y //x = 22, y = 12 y = x - y //x = 22, y = 10 x = x-y // x= 12, y=10

1

Sigiloso

1 de fev. de 2019

In python: a, b = b, a