Domanda di colloquio di L3Harris

Q: Given 2 numbers, without instantiating another variable, swap their values.

Risposte di colloquio

Anonimo

18 feb 2022

// assume a = 5, b = 2 a = a + b; // a = 7 , b = 2 b = a - b; // b = 5, a = 7 a = a -b; // a=2, b=5

4

Anonimo

19 mar 2021

with two variables X1 and X2: Swapping X1 to X2: X1*X2/(X1) = X2 Swapping X2 to X1: X2*X1/(X2) = X1

2