i dont know why people are getting difficulties in understanding but i would must say i there cant be an easier explanation. really a great resource for understanding the algorithm syntax and know the best solution you also explained the way to decrease the time and ans space complexity of the algorithm thankyou
@coldcoke9254
2 жыл бұрын
probably because it s the first lecture and we are already using concepts of functions and loops and lists...I'd recommend watching a one shot lecture on python by codewithharry and then coming to this that's what I did and now all this seems really simple...don't even need to watch all of it only till chapter 8.
@ANAND-zw1on
2 жыл бұрын
We can further simplify this by starting the loop from min(m, n) /2 to 1 and seperate sentence for testing the min(m, n) . Eg: if we take 100 and want to know the factors, first 100 is a factor, then there is no factor from 99 to 51. So we can skip that part completely. This is true for every other numbers.
@tavilefty
2 жыл бұрын
exactly man. this comment needs to be pinned.
@girish8579
Жыл бұрын
What about odd numbers?
@mrtalksick6178
3 ай бұрын
@@girish8579 instead of dividing by 2, take the quotient of the division i.e. min(m, n)//2.
@ruturajjadhav8905
4 жыл бұрын
def gcd(num1,num2): return max(list(set([i for i in range(1,num1+1) if num1 % i == 0]).intersection(set([i for i in range(1,num1+1) if num1 % i == 0])))) ## intersection : combines the common factors of given two sets ##just two lines
@SlickShitt
3 жыл бұрын
after intersection you used the first parameter instead of num2
@adityamehra7238
2 жыл бұрын
My brain literally exploded after realising there was 1 another way to write code for this gcd...... Meanwhile professor : you said 1? Wait hold my mike...... 💥💥... A beautiful lecture
@mandarchincholkar7250
5 жыл бұрын
Marvelous logic... Amazing... 👏👏👏👏🎉🎉🎊🎊🎊 only experienced programmers will get it..🔥🔥🔥
@panthrohit
5 жыл бұрын
Not an experienced programmer, still I get it... :)
@mandarchincholkar7250
5 жыл бұрын
@@panthrohit then you nailed it hardly.. 😎😎😎😎
@panthrohit
5 жыл бұрын
@@mandarchincholkar7250 This reminds me of the saying 'working hard or working hardly'. Whats my takeaway here....🤔😛😬
@mandarchincholkar7250
5 жыл бұрын
@@panthrohit bhai baat ko mat ghumaya kar.. 😂😂😂😂😂
@panthrohit
5 жыл бұрын
@@mandarchincholkar7250 😉
@coldcoke9254
2 жыл бұрын
probably because it s the first lecture and we are already using concepts of functions and loops and lists...I'd recommend watching a one shot lecture on python by codewithharry and then coming to this that's what I did and now all this seems really simple...don't even need to watch all of it only till chapter 8.
@Jaimin_Bariya
26 күн бұрын
Jp here again [comment number 51] Thank you, sir, :)
@anshulojha5699
4 жыл бұрын
The algo that u explain if I will learn that methods to minimize the all codes with time and memory then I will be the rank 1 in Google contests 🙏🙏
@sameers8510
3 жыл бұрын
You are simply superb sir Awesome explanation
@BiswajitDas-lk7pp
2 жыл бұрын
Amazing 😀😀😀
@arpitaingermany
6 жыл бұрын
The shorter python program was confusing min(m, n) this part
@vatsalgupta00
6 жыл бұрын
Divisor of a number cannot be larger than the number. Since we are trying to find common divisors, only divisors of smaller number are suffcient.
@DineshJunjariyaBEE
5 жыл бұрын
min(m,n) gives least of the two numbers
@anshulojha5699
4 жыл бұрын
Like min(6,8) so dono me vo common no hoga vo 6 se thoe hamesha less hi hoga like 2 here . That's why they used this concept ✅
@sravanchilumula5213
5 жыл бұрын
classes are in not the correct order please correct it!
A one line code -- print(next(a for a in range(63,0,-1) if 8888%a==0 and 63%a==0))
@bhupiagra1
6 жыл бұрын
you said actually any common factor must be less than min(m, n) but how this statement is justifying gcd of (2, 4) ?
@tabassumhebbalkar
6 жыл бұрын
including the minimum of both.
@panthrohit
5 жыл бұрын
Must be less than or equal to min(m,n)
@DineshJunjariyaBEE
5 жыл бұрын
he meant min or less than min
@bhargavdobariya5859
3 жыл бұрын
great explanation....thanks a lot sir
@vatsal_gamit
3 жыл бұрын
def gcd3(m,n): return max([i for i in range(1,min(m,n)+1) if ((m%i)==0 and (n%i)==0)]) print(gcd3(3575,978))
@izharkhankhattak
3 жыл бұрын
nice
@tavilefty
2 жыл бұрын
wonderful lecture.
@pratapkhandekar8322
5 жыл бұрын
You are explaining code directly It is hard to understand
@sanjayguptacg486
5 жыл бұрын
low sound.
@prashnatdivase8523
4 жыл бұрын
def gcd(m,n): fm=[] # list down factor of m in fm fn=[] # list down factor of m in fn for i in range(1,m+1): if (m%i ==0): fm.append(i) print("fm is",fm) for j in range(1,n+1): if (n%j ==0): fn.append(j) print("fn is",fn) cf=[] # for returning largest value for k in fm: if k in fm: cf.append(k) print("The largest GCD is: %d "%cf[-1]) gcd(10,8) above programs give correct output but i would like to understand why below program is not giving same output: def gcd(m,n): i=min(m,n) while i>=0: if m%i==0 and n%i==0: return i else: i=i-1 v=gcd(10,8) print(v) Sorry if i am missing anything and would be great if someone explain last optimize example in details
@coldcoke9254
2 жыл бұрын
the code works just fine tho, just chane
@venkatashasidharreddychali7485
Жыл бұрын
give the brackets correctly, it worked for me, I alos got the wrong output when i used this (m%i) ==0 & (n%i) ==0 after tweaking it to this ((m%i) ==0) & ((n%i) ==0), i got the correct output
@prashnatdivase8523
Жыл бұрын
@@venkatashasidharreddychali7485 thank you
@exploringlife2904
4 жыл бұрын
not running in python mrcf
@gauravjoshi7589
3 жыл бұрын
i am not getting any error and also not getting any output
@sagarsagar-xr7bo
4 жыл бұрын
Low sound boring ,speak loudly sir
@sumitbhattacharyya2058
6 жыл бұрын
sound quality is not satisfactory
@pk15692
5 жыл бұрын
You can use a volume booster for chrome to enhance the sound volume
Пікірлер: 51