3

Viva te 'swap without 3rd variable' khub jigges kore. Real code e std::swap use korbe.

Solution 1: Using 3rd variable C++ 4 lines
int a = 10, b = 20;
int temp = b;
b = a;
a = temp;
Solution 2: Without 3rd variable (+ / -) C++ 3 lines
a = a + b;
b = a - b;
a = a - b;
Solution 3: Without 3rd variable (XOR) C++ 3 lines
a = a ^ b;
b = a ^ b;
a = a ^ b;
Solution 4: std::swap (best in practice) C++ 2 lines
int a = 10, b = 20;
swap(a, b);

Note: swap() needs #include <utility> and #include <algorithm>.