Interview Question #5 | Software Engineering Interviews

preview_player
Показать описание
#shorts
Рекомендации по теме
Комментарии
Автор

Python flexing in the corner: a, b = b, a

ThisIsSidam
Автор

me who's watching this after printing "hello world"

AYAANALI-cx
Автор

In the era of entertainment shorts, there are people who care more about the students. It takes a lot of time to prepare the setup, animate, record and edit the video. I'm glad to have this in my preparations :)

abhishekranjan
Автор

a= a*b;
b=a/b;
a=a/b;
Sopln(a + b);
Note : this approach is applicable only when a and b are greater then 0

abhinav
Автор

Didi keep posting such videos, this questions are really helpful to prepare for interviews and even just to increase our knowledge 👍

introvertsenpai
Автор

We can also use Division and Multiplication

sulemanakhter
Автор

Create a 3rd variable c then,
c=a
a=b
b=c

nitinvishwakarma
Автор

Very easy ma'am assuming int a =5; int b = 10;
a= a+b;
b = a-b;
a= a-b;
Sout ("the value of a "+a+" the value b "+b)

AIWallah
Автор

Ohhh xor nahi pata tha, ek long video baniye covering all these types of questions.

tgayush
Автор

Ek temporary variable se bhi kar sakte hai
Jaie ki
temp=a
a=b
b=temp

sabainamdar
Автор

This is done by Python program firstly input variables by the user A and B and then use addition and subtraction

Science_Study_Material
Автор

This can also be done using a third variable, t(say)
t=a
a=b
b=t

shubhajitsahoo
Автор

In programming, the "=" symbol is the assignment operator, not an equality operator. So, the statement "a = a - b;" should be read as "a is assigned the result of a minus b" or "a gets the value of a minus b." not "a" is equals to "a-b"

mohammadwadhoofficial
Автор

We can also use multiplication and division in the exact same way as addition and subtraction.

aqeelanaznaz
Автор

Me who use temp variable for swap like that 😅👇

temp=a;
a=b;
b=temp;

Princejha
Автор

We can use array discharing methods like
[a, b]=[b, a]

taiyebkhan
Автор

Thank you so much shradha didi, I got placed in TCS just becoz learnt so many things from apna college yt channel.. nd keep going and its always helpful to many..🎉

harshavardhanmeesala
Автор

But we can solve this without using addition and subtraction with multiplication and division as well
Let a = 5, b=6
a = a*b = 30
b = a/b = 5
a = a/b = 6

genesis
Автор

Third approach is letting a third variable and doing
C=b
B=a
A=c

ABHINAV_RAJPUT.
Автор

We can use multiplication and division tooo....
A = 5
B= 4
A=a*b //20
B= a/b //b=5
A= a/b //a=4

adityasultania