L4. Print all prime factors of a Number | Maths Playlist

  Рет қаралды 25,021

take U forward

take U forward

4 ай бұрын

Notes/Codes/Problem links under day 8 of A2Z DSA Course: takeuforward.org/strivers-a2z...
Entire playlist: • Maths Playlist | Langu...
Follow us on our other social media handles: linktr.ee/takeuforward

Пікірлер: 54
@md.ualiurrahmanrahat2400
@md.ualiurrahmanrahat2400 14 күн бұрын
The optimal approach is so amazing. Thanks Striver for GOAT level stuff.
@2amCoder
@2amCoder 3 ай бұрын
last solution was actually something i never came across has thought of it but never applied great vid
@mohammedraheel2223
@mohammedraheel2223 4 ай бұрын
One after other video is uploading it is very much satisfying for the beginners😊.. Thanks a lot Striver Bhaiya ❤
@stith_pragya
@stith_pragya 3 ай бұрын
Understood......Thank You So Much for this wonderful video......🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@subee128
@subee128 3 ай бұрын
Thank you very much
@Anonymous____________A721
@Anonymous____________A721 4 ай бұрын
God of dsa and cp
@codeman3828
@codeman3828 3 ай бұрын
Understood. thanks
@reddygopichand2002
@reddygopichand2002 4 ай бұрын
Understood ❤
@shashankgsharma0901
@shashankgsharma0901 12 күн бұрын
Understood!
@Express871
@Express871 4 ай бұрын
Can you videos on your own dsa sheet string Question
@kedarmalap7525
@kedarmalap7525 4 ай бұрын
Can you please upload detailed video on strings....
@prajjwaltripathi2374
@prajjwaltripathi2374 3 ай бұрын
I can't find the c++ code for the last method, please someone help!
@shaiksoofi3741
@shaiksoofi3741 Ай бұрын
understood
@hardikpatel352
@hardikpatel352 Ай бұрын
understood class Solution{ public: vectorAllPrimeFactors(int N) { vector vec; for(int i=2; i
@knowthrvdo
@knowthrvdo 4 ай бұрын
Plz complete remaining sheet as well
@anshgupta8860
@anshgupta8860 Ай бұрын
for number like 37 ,n stilll remains 37 which is a factor ,so we add and in case of 16 ,n reduces to 1 ,so we dont need to add it to list ,that;s why n!=1 then add to list
@batmanlovesjokerr
@batmanlovesjokerr 3 ай бұрын
8:30- actual method 14:40 more optimised
@HarshvardhanSankpal
@HarshvardhanSankpal Ай бұрын
12:30 in this code we need to also apply isPrime( i ) in the if statement, else we are blindly adding also the divisors, but the question demands prime divisors.
@afreenmohammad8716
@afreenmohammad8716 Ай бұрын
no you are wrong. for example,2 is a prime number. when 2 divdes the number as many times as possible then 2 mutiples cannot divide the number. similarly for 3 etc.
@AkbarKhan-gd2bw
@AkbarKhan-gd2bw 3 ай бұрын
💖💖💖
@user-nb6fx1rf9i
@user-nb6fx1rf9i 4 ай бұрын
Time hi nahi mil reha h abhi...varana ek din me ye playlist khatam kar denge... Striver Jindabaad! 😂
@VikashPatel-sf6ub
@VikashPatel-sf6ub 4 ай бұрын
In last approach, why we are adding n in list if it's not equal to 1 without checking it's prime or not.
@mrinmoykalita4456
@mrinmoykalita4456 3 ай бұрын
Considering worst case of factors of primes of number can go upto number. So, we are considering total spaces upto the numbers.
@yash2275
@yash2275 3 ай бұрын
See If there is the value Of N which is prime then we are iterating i upto sqrt N so we will not reach to the N through i but we know that if n is not 1 then it will also be the factor so we will add it to the answer see dry run the code for 65 then you will understand
@HarshvardhanSankpal
@HarshvardhanSankpal Ай бұрын
for solving the edge case of 37, cant we simpliy check if n is prime, if yes, we know theres only 1 pime factor that is itself ??
@anonymous10906
@anonymous10906 21 күн бұрын
consider for 35
@wul_frik
@wul_frik 2 ай бұрын
I have a doubt, why can't multiple prime numbers be there after the loop ends, like after the for loop ends, the number might be something like p1 * p2, where p1 and p2 are primes?
@vipuljamod4119
@vipuljamod4119 Ай бұрын
If n = 221. Then i * i
@praphullpandey425
@praphullpandey425 4 ай бұрын
First view ❤
@codingp110
@codingp110 17 күн бұрын
US!
@veerverma5586
@veerverma5586 4 ай бұрын
Bhaiya string and recursion ka kya plan hai??
@es_amit
@es_amit 4 ай бұрын
aditya verma se pdhle recursion bhot mst hai uska
@veerverma5586
@veerverma5586 4 ай бұрын
@@es_amit phir lekin sequence toot jayega, ab dekhta hoon agar thode din tak nhi kiya post toh kahi or se he krna padega
@es_amit
@es_amit 4 ай бұрын
@@veerverma5586 bhai ek baar pdh ke toh dekh fir btaio (recursion) Aditya verma se. mera recursion bhot weak tha phle ab dp ke questions bde aaram se solve kr deta hu
@veerverma5586
@veerverma5586 4 ай бұрын
@@es_amit ohh 😮, yeh he hai kya 19 videos wala?
@es_amit
@es_amit 4 ай бұрын
@@veerverma5586 ha Bhai aaram se dekh fir btaio mujhe kaisi lgi, backtracking ki bhi dekh lio
@AdityaGrover-ly9jf
@AdityaGrover-ly9jf 4 ай бұрын
First view
@AkOp-bf9vm
@AkOp-bf9vm 2 ай бұрын
did anyone understand the last 16 example which he give to try itself
@vipuljamod4119
@vipuljamod4119 Ай бұрын
n = 16. (1) i = 2 i*i = 4 < 16 16 % 2 = 0 . list.add(2) while(n % 2 == 0) { 16/2 = 8 8/2 = 4 4/2 = 2 2/2 = 1. } Now while loop break. i is become 3 and n is become 1. 3 * 3 = 9 < 1 ❌ so condition false So for loop break. And now check if n != 1 n = 1 and 1 = 1 so condition false ❌ And final ans list = [2]
@AkOp-bf9vm
@AkOp-bf9vm 28 күн бұрын
@@vipuljamod4119 thnx bro
@gauristar4094
@gauristar4094 Ай бұрын
But the final optimized approach doesn't work for some numbers like 6.
@vipuljamod4119
@vipuljamod4119 Ай бұрын
public static ArrayList primeFactor(int n) { ArrayList al = new ArrayList(); for(int i=2; i * i
@vipuljamod4119
@vipuljamod4119 Ай бұрын
Try this code.., this working perfectly.
@AkashSingh-vloger
@AkashSingh-vloger 3 күн бұрын
Yes bro ​@@vipuljamod4119
@genzsubh
@genzsubh 4 ай бұрын
Nhi karna print bhai... Kyu paresan kr rha h. Job dega to bol
@priyanshubiswas9396
@priyanshubiswas9396 2 ай бұрын
tujhe toh waise v koi job na de🤣🤡
@genzsubh
@genzsubh 2 ай бұрын
@@priyanshubiswas9396 🤣🤣🤣🤣
@chiragbansod8252
@chiragbansod8252 4 ай бұрын
understood
@anshgupta8860
@anshgupta8860 Ай бұрын
understood
@hardikpatel352
@hardikpatel352 Ай бұрын
understood
L5. Power Exponentiation | Maths Playlist
12:39
take U forward
Рет қаралды 16 М.
L6. Sieve of Eratosthenes | Maths Playlist
18:27
take U forward
Рет қаралды 26 М.
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 64 МЛН
마시멜로우로 체감되는 요즘 물가
00:20
진영민yeongmin
Рет қаралды 32 МЛН
Kadane's Algorithm | Maximum Subarray Sum | Finding and Printing
20:09
take U forward
Рет қаралды 342 М.
L3. Check if a Number if Prime or not | Maths Playlist
7:10
take U forward
Рет қаралды 16 М.
Coding Interviews Be Like
5:31
Nicholas T.
Рет қаралды 6 МЛН
BS-10. Finding Sqrt of a number using Binary Search
17:11
take U forward
Рет қаралды 105 М.
L7. Count Prime in a range L-R | Maths Playlist
16:39
take U forward
Рет қаралды 9 М.
L12. Print all Permutations of a String/Array | Recursion | Approach - 1
19:07
L4. Jump Game - I | Greedy Algorithm Playlist
10:53
take U forward
Рет қаралды 18 М.
L5. Jump Game - II | Greedy Algorithm Playlist
16:45
take U forward
Рет қаралды 22 М.
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 64 МЛН