L6. Recursion on Subsequences | Printing Subsequences

  Рет қаралды 681,985

take U forward

take U forward

Күн бұрын

Check our Website:
In case you are thinking to buy courses, please check below:
Link to get 20% additional Discount at Coding Ninjas: bit.ly/3wE5aHx
Code "takeuforward" for 15% off at GFG: practice.geeks...
Code "takeuforward" for 20% off on sys-design: get.interviewr...?_aff=takeuforward
Crypto, I use the Wazirx app: wazirx.com/inv...
Take 750 rs free Amazon Stock from me: indmoney.oneli...
Earn 100 rs by making a Grow Account for investing: app.groww.in/v...
Linkedin/Instagram/Telegram: linktr.ee/take...
---------------------------------------------------------------------------------------------------------------------------------------------------- Please check out the entire channel for other sets of series on tougher and complex topics. Also do consider subscribing :)
Please check out the SDE sheet which the entire country is using and getting placed at top-notch companies: takeuforward.o...
Checkout Striver's Handles: linktr.ee/take...

Пікірлер: 595
@jaimitkumarpanchal7603
@jaimitkumarpanchal7603 Жыл бұрын
Man i usually don't comment on KZbin videos, but i just solved 3 medium level questions in under 20 mins. Damnnnnnnn i have no words to express. but this video specifically is a gem to solve most of the recursion sub-seq problem. Thank you so much 😄 Edit : i have watched this video 2-3 months back(December) for dynamic programming, till this day i remember every detail of the video.
@mrsmurf911
@mrsmurf911 Жыл бұрын
from sklearn.pipeline import Pipeline import sklearn.svm from sklearn.linear_model import LogisticRegression knn=KNeighborsClassifier(n_neighbors=8) rfc=RandomForestClassifier(max_features=2,n_estimators=64,bootstrap=False,oob_score=False) svm = svm.SVC(kernel='rbf',C=1,gamma=1) lr=LogisticRegression(C=0.01,max_iter=100,penalty='l2') # define the pipeline # define the pipeline pipe = Pipeline([ ('scaler', StandardScaler()), ('knn', knn), ('rfc', rfc), ('svm', svm), ('lr', lr), ('preds', FunctionTransformer(lambda x: x.predict_proba(x)[:,1].reshape(-1,1))) ]) # fit the pipeline to your data pipe.fit(X_train, y_train) # predict on new data y_pred = pipe.predict(X_test) # evaluate the pipeline's performance accuracy = pipe.score(X_test, y_test)
@stain5570
@stain5570 5 ай бұрын
hii, may I know what are you doing right now
@samratpatel8060
@samratpatel8060 5 ай бұрын
@@stain5570 he is a SDE-3 at CornHub
@SUJAYNIRANJANNAIKCSE23D
@SUJAYNIRANJANNAIKCSE23D 2 ай бұрын
​​@@stain5570 same question ⁉️
@ashwanisharma8903
@ashwanisharma8903 2 жыл бұрын
Best thing is you have very deep understanding of the topics and you code your own way. While other videos mostly pick code from GFG and explain which goes above head. Thanks for lovely explanation.
@jaibhagat7441
@jaibhagat7441 2 жыл бұрын
Huh
@aeroabrar_31
@aeroabrar_31 2 жыл бұрын
The code for printing string subsequences. package Recursion_2; import java.util.ArrayList; public class Subsequences { public static void main(String[] args) { String s="abcd"; char[] c=s.toCharArray(); print_string_subseq(new ArrayList(),0,c,s.length()); } public static void print_string_subseq(ArrayList al,int ind,char[] c,int n) { if(ind>=n) { if(al.size()==0) System.out.print("{}"); for(char t:al) { System.out.print(t); } System.out.println(); return; } print_string_subseq(al,ind+1,c,n); al.add(c[ind]); print_string_subseq(al,ind+1,c,n); al.remove(al.size()-1); } } Output : {} d c cd b bd bc bcd a ad ac acd ab abd abc abcd
@roshangeorge97
@roshangeorge97 Жыл бұрын
He is unique XD
@sanjayhazra181
@sanjayhazra181 8 ай бұрын
Yup, also some just mug up from chatgpt and code .
@AbhinavKumar-tg4il
@AbhinavKumar-tg4il 5 ай бұрын
after watching 3 times, now understood. Those who are not able to understand, it's okay, retry, you will get it, and after that you will feel good.
@dgvj
@dgvj 2 жыл бұрын
Best series on recursion in the internet. Thanks alot for your time and effort.
@tharundharmaraj9045
@tharundharmaraj9045 Жыл бұрын
Simple english....No confusions......... Great work
@sarathchandra941
@sarathchandra941 3 жыл бұрын
Finally, the day has come to understand and as well code for the same.
@ashutoshthite
@ashutoshthite 2 жыл бұрын
💯💯
@sniper_army3735
@sniper_army3735 3 ай бұрын
Amazing man, doesn't even know us, isn't even related to us, but still is doing so much for the students aspiring to be software engineers. People like him are the ones who become inspiration to others to bring change to the society.
@ujjwalshrivastava3594
@ujjwalshrivastava3594 2 ай бұрын
Bro I still not able to understand recursion very much confusing to me
@xdjqye
@xdjqye Ай бұрын
@@ujjwalshrivastava3594 try to draw the recursion tree alongside striver, it really cleared up things for me
@jayeshbangar8373
@jayeshbangar8373 2 жыл бұрын
JAVA Code- public static void sub(ArrayList al, int arr[], int i){ if(i == arr.length){ System.out.println(al.toString()); return; } al.add(arr[i]); sub(al,arr,i+1); al.remove(al.size()-1); sub(al,arr,i+1); }
@jatin_lanje
@jatin_lanje Жыл бұрын
with small correction public static void sub(ArrayList list, int arr[], int i){ if(i == arr.length){ if(list.size()>0){ System.out.println(list.toString()); } return; } list.add(arr[i]); sub(list,arr,i+1); list.remove(list.size()-1); sub(list,arr,i+1); }
@mayankshukla7195
@mayankshukla7195 Жыл бұрын
thanku so much brother
@travelnlearn
@travelnlearn 2 жыл бұрын
THANK YOU BRO, BEST PART: YOU COmpletely connects with your audience and each and every step goes direclty into our brain and we understand everything. Thank You & keep it up
@potatocoder5090
@potatocoder5090 2 жыл бұрын
Brilliant explanation! I never quite understood this question before watching this video. The take/not take pattern is going to be in my head forever. Thank you so much! You're an amazing teacher :)
@ShubhamSinghMr.s
@ShubhamSinghMr.s 2 жыл бұрын
JAVA CODE FOR THE SAME WILL BE ::- public static void main(String[] args) { int[] arr = { 3, 1, 2 }; ArrayList list = new ArrayList(); printSub(0, arr, list); } private static void printSub(int i, int[] arr, ArrayList list) { if (i == arr.length) { System.out.println(list.toString()); return; } list.add(arr[i]); printSub(i + 1, arr, list); list.remove(list.size() - 1); printSub(i + 1, arr, list); }
@badboybb519
@badboybb519 Жыл бұрын
It helped me a lot bro
@klakshmisuryateja8320
@klakshmisuryateja8320 Жыл бұрын
Very helpful
@pehdntene6473
@pehdntene6473 10 ай бұрын
I do not understand one thing if we try to apply the same logic but when the return type is List this doesn't work cause instead we get an empty list when i == arr.length
@VollalaPavanSathwik
@VollalaPavanSathwik 6 ай бұрын
@@pehdntene6473 import java.util.ArrayList; import java.util.List; public class rec_subseq { public static void main(String[] args) { int[] arr={3,1,2}; ArrayList list = new ArrayList(); ArrayList li= new ArrayList(); subseq(0,arr,list,li); System.out.println(li); //System.out.println(li.toString()); } static ArrayList subseq(int i,int[] arr, ArrayList list,ArrayList li) { if(i>=arr.length) { li.add(list); return li; } list.add(arr[i]); subseq(i+1,arr,new ArrayList(list),li); list.remove(list.size()-1); subseq(i+1,arr,new ArrayList(list),li); return li; } } Try this
@phaneendra_guduru
@phaneendra_guduru 5 ай бұрын
Thank you brother 😊
@NiyatiShah24
@NiyatiShah24 Ай бұрын
You made it much simple to understand! A true teacher! Thank you 💚
@yotowilliam5465
@yotowilliam5465 Жыл бұрын
Amazed by your lessons, i feel like i know recursion better than before, thanks bro.
@adityadeshbhartar7172
@adityadeshbhartar7172 Жыл бұрын
What a explaition strting from base case to dry run to recursion tree , Fully fantastic, even i used to code in java still noone can reach your level of explanation ❤🤘 Best video...
@ayushuniyal2586
@ayushuniyal2586 Жыл бұрын
after watching many videos on recursion ,i was not able to do dry run of recursion question .Now i can say this is the best explaination for begineers to do dry run and understand recursion.just fantastic bhaiya like how easy you explained .hats off nailed it respect++.
@ujjwalshrivastava3594
@ujjwalshrivastava3594 Жыл бұрын
How to learn recursion?
@sureshgarine
@sureshgarine 2 жыл бұрын
indeed, it's a wonderful explanation. thanks for taking time and doing this for community
@ardhidattatreyavarma5337
@ardhidattatreyavarma5337 Жыл бұрын
after this video I solved subset sum pretty easily. Thank for your crystal clear explanation
@habeeblaimusa4466
@habeeblaimusa4466 Жыл бұрын
I had to watch this video for more than 5 times. God bless you bro
@jyotirmoy_dey
@jyotirmoy_dey 5 ай бұрын
This guy makes recursion look easy and fun. Kudos to you! Amazing job, very inspiring!
@soumyajeetsengupta3064
@soumyajeetsengupta3064 2 жыл бұрын
I have seen soo many videos for this problem and never understood anything but your explanation it was awesome it gave me confidence to solve any problem of this kind(take or not take). Thankyou Striver sir!
@ShubhamKumar-sj6dp
@ShubhamKumar-sj6dp 2 жыл бұрын
or it could be opposite , since you tried it many times , this was the time it clicked , it would have been same if you would have watched this video first and other video would have clicked !!!!!!
@udaykulkarni5639
@udaykulkarni5639 Жыл бұрын
Man! This is crazzyyyy!! I never really comment on KZbin. But this is some next level shit ! I kept memorizing the subseq code as I was sure i would never understand this. But you have finally made it clear and I dont need to memorize it ! Its pretty straight forward! Thanks a ton😊❤
@studynewthings1727
@studynewthings1727 Жыл бұрын
Thankyou STRIVER, for explaining the subsequence problem in a awesome manner.
@SumitTiwari-f7t
@SumitTiwari-f7t 5 ай бұрын
Thankyou for making videos of recursion and covering all topics. It gives me confidence and boost-up in my rating.
@samsmith3961
@samsmith3961 2 жыл бұрын
this has been beautifully explained ..I've been searching for this explanation for hours now and this was good
@AngadSingh97
@AngadSingh97 6 ай бұрын
Excellent explanation, itni baar dekhne ke baad it is even possible to watch at 3x and revise easily, which is amazing.
@visheshwaghmare7504
@visheshwaghmare7504 2 жыл бұрын
If we want to avoid the remove part, we can first call without adding and then add the element and call function again with the added element in the vector.
@amit2194
@amit2194 Жыл бұрын
if you want to remember it like using " take " and "not take " you should follow that
@NitishKumar-yy9kn
@NitishKumar-yy9kn 5 ай бұрын
if we pass the vector by value, removal will not be needed
@RishabhJain-iz5xk
@RishabhJain-iz5xk 2 жыл бұрын
HANDS DOWN BEST EXPLANATION ON INTERNET!
@iamabishekbaiju
@iamabishekbaiju 8 ай бұрын
I watched it once didn't understand, but after that watched again by following him with a pen and paper and understood completely.
@iitimunda
@iitimunda 5 ай бұрын
02:18 Generate all subsequences for an array using recursion 04:36 Understanding the structure and pattern of code is crucial for solving problems. 06:50 Code implementation to create a subsequence using recursion. 09:16 By making recursive calls with different indices and choosing whether to include the last element, you can generate all possible subsequences of an array. 11:27 Remove elements from an array based on specific conditions. 13:39 Understanding the concept of adding and removing items in a sequence 15:42 Printing the values in a recursion tree 17:46 Printing subsequences using recursion 19:38 Print a data structure to display the subsequence 21:20 The algorithm involves picking or not picking elements from a given array. 23:10 Time complexity is 2^n and space complexity is O(n)
@soorma7869
@soorma7869 2 жыл бұрын
Finally it's crystal clear... After watching this video 3-4 times
@SuperWhatusername
@SuperWhatusername 2 жыл бұрын
Earlier I was learning recursion and dynamic programming together and that was my mistake. Thanks for creating this playlist and awesome explanation.
@azaanakhtar1974
@azaanakhtar1974 2 жыл бұрын
Uh are write in which language Cpp Or java
@azaanakhtar1974
@azaanakhtar1974 2 жыл бұрын
I wrote in java bt i faced an error working with array and list
@SuperWhatusername
@SuperWhatusername 2 жыл бұрын
@@azaanakhtar1974 CPP
@ratanmasanta3210
@ratanmasanta3210 2 жыл бұрын
@@azaanakhtar1974 Try this: static void findSubsequence(int index, int[] array, ArrayList arrayList) { if(index == array.length) { System.out.println(Arrays.toString(arrayList.toArray())); return; } arrayList.add(array[index]); findSubsequence(index+1, array, arrayList); arrayList.remove(arrayList.size() - 1); //need to remove last element findSubsequence(index+1, array, arrayList); }
@azaanakhtar1974
@azaanakhtar1974 2 жыл бұрын
@@ratanmasanta3210 thanks buddy
@aravinda1595
@aravinda1595 2 жыл бұрын
Thanks a lot sir,I have been frustrated since a long time because of recursion ,it felt impossible for me to solve any leetcode problem but after your series i feel more confident in approaching any backtracking problem.You just don't explain a solution for a particular problem but a solution which can be modified and used for any other similar problem.
@ujjwalshrivastava3594
@ujjwalshrivastava3594 Жыл бұрын
Bro how u understand recursion?
@abdullahaladibakhand960
@abdullahaladibakhand960 16 күн бұрын
We can do it without even deleting. We can follow the following procedure : at first call recursion function for not pick then add the element to it and then call recursion function with picking the current element. It will also cover all subsequence. But we do not need to delete the unpicked element.
@akshaybhagwat6179
@akshaybhagwat6179 2 жыл бұрын
The best explanation ever exist on the youtube.
@rumiNITPatna
@rumiNITPatna 5 ай бұрын
thank u so much striver ! i was struggling with this one and i finally understood this using recursion tree.. THANK YOUUUUUUU
@sojwalgosavi4406
@sojwalgosavi4406 2 жыл бұрын
You are taking great efforts and we are learning from you Striver.
@AkshatMehra-l4b
@AkshatMehra-l4b 11 ай бұрын
Amazing, lost for words 👏🏽👏🏽👏🏽
@ashokdurunde1814
@ashokdurunde1814 2 жыл бұрын
Thank you so much! You're an amazing teacher :)
@Codebond7
@Codebond7 Жыл бұрын
Understood. will complete recursion today no matter how much time it takes.
@arnabkundu1648
@arnabkundu1648 7 ай бұрын
I have understood it extremely well. Thank you sir.
@wassupCraji
@wassupCraji Ай бұрын
This was some crazy cool thing to learn today had so much fun!
@Cool96267
@Cool96267 3 жыл бұрын
Hey Striver, Could you also please attach the link of the respective leetcode questions?
@godessGOAT
@godessGOAT 2 жыл бұрын
found?
@Dheeraj-ed6rr
@Dheeraj-ed6rr 2 жыл бұрын
@@godessGOAT Leetcode 78
@akshanshsharma6025
@akshanshsharma6025 2 жыл бұрын
@@Dheeraj-ed6rr thanku bro
@vinnuhary2198
@vinnuhary2198 9 ай бұрын
mad respect to this man for keeping it super simple
@madhujustin2124
@madhujustin2124 4 ай бұрын
STARTED YESTERDAY, IT CAN BE HELPFUL FOR THOSE WHO STARTED NOW...LIKE ME... PYTHON CODE FOR THE SAME IS: def subseq(index, current,arr): if index >= len(arr): print(current) return current.append(arr[index]) subseq(index+1, current,arr) current.pop() subseq(index+1, current,arr) arr = [3,1,2] index=0 subseq(index, [ ] ,arr)
@sid1993ful
@sid1993ful 4 күн бұрын
What if we are not to print but instead create a list of list and return that?
@vvssreddy903
@vvssreddy903 6 ай бұрын
I have a small doubt, during 3rd recursive call the list is [3,2,1] and i value is 3. Now as i= arr.length, we print the list. After that to back track, we remove recently added element which is 2. Now the list becomes [3,1] but the i value doesnt change. It remains same 3.and after removing, we did sub(al,arr,i+1) which is sub([3,1],arr,4).im confusing here
@arshadshaik4961
@arshadshaik4961 6 ай бұрын
When we reach I=3 we actually increase for the branch which is going through right side for left side branch also we get I=3 only because we had called the both right side and left side branches in same function which is f(2, {3, 1}). Just go with tree and you can easily understand
@gwalaniarun
@gwalaniarun 3 жыл бұрын
Awesome man, love your explainatiton.
@tarun1684
@tarun1684 6 ай бұрын
Apart lecture..vdo end m jo gaane ki tune chlti h.. like it..😂😂❤
@sreenandini766
@sreenandini766 2 жыл бұрын
Super explanation sir .Thank you so much❤️
@sumitvishwkarma6907
@sumitvishwkarma6907 Жыл бұрын
Now I understand this subsequence, after watching famous courses of CN, CB, I don't understand from them that deeply
@Ayushkumar-co9mc
@Ayushkumar-co9mc 6 ай бұрын
Thanks a lot sir, now its crystal clear i made 2-3 recursion trees by my own it took me an hour but now its very clear.
@sagarsinha6561
@sagarsinha6561 Жыл бұрын
Hey Striver, your approach is superb. However, I have followed another strategy which is more intuitive for me, the code for which is: def fn(i, n, arr, osf): if (i >= n): print(osf) return fn(i+1, n, arr, osf) fn(i+1, n, arr, osf+str(arr[i]))
@sagarsinha6561
@sagarsinha6561 Жыл бұрын
In your way, it can be termed as don't pick-pick strategy (yours being pick/remove) 😅
@ramyavennapusa736
@ramyavennapusa736 3 ай бұрын
But, somehow for printing the subsequences of an array, this method is failing
@sharmakartikeya
@sharmakartikeya 3 жыл бұрын
Just don't stop uploading anytime you feel you are not getting enough views. Good Luck.
@sumanthvarmakarampudi7251
@sumanthvarmakarampudi7251 2 жыл бұрын
Super Clear, Great Effort Always thankful to you sir
@Malayalam_learner
@Malayalam_learner 20 күн бұрын
ధన్యవాదాలు ❤
@chandan1929
@chandan1929 2 жыл бұрын
if I don't pass the vector &ds as reference then I don't have the need to ds.pop_back() correct ??
@takeUforward
@takeUforward 2 жыл бұрын
Then it creates a new copy everytime, which will lead to tle :(
@ryanmathew6397
@ryanmathew6397 Жыл бұрын
That really was one of the best way to explain sub-sequence.
@kanishkasingh2324
@kanishkasingh2324 2 жыл бұрын
Humour and wit with abundance of knowledge and talent!
@horccruxxxop4184
@horccruxxxop4184 2 жыл бұрын
Hello bhai. 12:07 pr when we had popped 2 then it can to next line where ind+1 should be done but you had passed 3 why??
@niitteenpathak5620
@niitteenpathak5620 2 жыл бұрын
Thank you so much for amazing explanation.
@omkarwarule5483
@omkarwarule5483 Жыл бұрын
one of the beautiful play list for recursion on you tube
@factsmotivation7728
@factsmotivation7728 2 жыл бұрын
Thanks you so much sir for this wonderful content ,i loved with recursion sir 🙏🙏
@sadmanmehedisivan6581
@sadmanmehedisivan6581 2 жыл бұрын
It will be so cool if you can add the codes in the description!
@shreeshah8745
@shreeshah8745 2 жыл бұрын
Can someone please explain why at 15:42, when we move to 'not pick' any value from array we still increase our index value to 1?
@takeUforward
@takeUforward 2 жыл бұрын
Coz if u don’t pick, why will u stay on same index.
@shreeshah8745
@shreeshah8745 2 жыл бұрын
@@takeUforward Thank you sir for replying. I got it now. 👍
@saahilsharma6537
@saahilsharma6537 3 жыл бұрын
Java Code :- public static void func(int i,List a,List arr) { if(i>=arr.size()) { System.out.println(a); return; } a.add(arr.get(i)); func(i+1,a,arr); a.remove(arr.get(i)); func(i+1,a,arr); } }
@saira18926
@saira18926 3 жыл бұрын
thank you
@k10n28
@k10n28 3 жыл бұрын
i was looking for the same thanks
@hrithikrudra4292
@hrithikrudra4292 3 жыл бұрын
Bro,thnaks for this..But I am facing some problem while taking the input as array.. Error:For 2 it is showing out of bound index..Anyone help me out in this,issue??Thanks in advance My code: /** * PrintAllSubsequence */ import java.util.*; public class PrintAllSubsequence { static void printSubsequence(int index,ArrayList res,int arr[]){ if(index==arr.length) { System.out.println(res); return; } //taking the arr input res.add(arr[index]); printSubsequence(index+1, res, arr); //not taking the array input res.remove(arr[index]); printSubsequence(index+1, res, arr); } public static void main(String[] args) { int []arr={3,1,2}; ArrayList res=new ArrayList(); printSubsequence(0, res , arr); } }
@swapnilnandedkar3930
@swapnilnandedkar3930 3 жыл бұрын
@@hrithikrudra4292 change your res.remove(arr[index]); statement with res.remove(new Integer(arr[index])); arrayList have 2 remove method one with index and other with object. res.remove(arr[index]); this statement try to call remove with index because arr[index] giving int and Collection only work with objects. Because of this you are getting outofbound. Either use new Integer(arr[index]) or convert int []arr={3,1,2} to arraylist
@hrithikrudra4292
@hrithikrudra4292 3 жыл бұрын
@@swapnilnandedkar3930 thanks,bro..👌👌
@bazeer1498
@bazeer1498 Жыл бұрын
after watching 5 times with paralally coding ..now i finally understand the whole concept of take and not take lol😆
@MindMunchies.
@MindMunchies. 2 жыл бұрын
Thanks striver After watching it from all the tutors on youtube Finally i conclude you are a true gem 🤍 bro... will definitely meet you one day insha allah
@alifaisal1475
@alifaisal1475 2 жыл бұрын
YOU ARE AWESOME! Explained this difficult topic with ease, and in-depth as well. ❤‍🔥
@veekshithcb
@veekshithcb 2 жыл бұрын
You have to keep it in your head everyday till your . retirement......
@pratyushvaibhav
@pratyushvaibhav 2 жыл бұрын
Watched the intermediate few minutes thrice and finally understood , lesson I learn't : sometime we need a small self-upgradation to understand the educator , not always the teacher(educator) is bad .
@green_lucozade
@green_lucozade 16 күн бұрын
in the code where not pick is before pick, why do we do pop_back after the function call for pick?
@ironman-bz7wx
@ironman-bz7wx Ай бұрын
9:30 , uare not passing the array in the method,how can we add arr[index] ?
@Tbm4545
@Tbm4545 Ай бұрын
Thats was just a dry run not actual code, just understand the process finally he has given the code too.
@thisisrajneel
@thisisrajneel 2 жыл бұрын
why does the vector have to be passed by reference? at 20:07
@sriramrajkumar2774
@sriramrajkumar2774 11 ай бұрын
Anyone clear me this doubt. At 22.38 striver changed not pick first then picked second i thing the pop_back is not necessary. Am i correct?
@straightfacts5683
@straightfacts5683 11 ай бұрын
i have same doubt couldnt understand that
@consistency_Is_key
@consistency_Is_key 2 жыл бұрын
watched it 4 times to understand this above 80% ,nice
@Nitin-x4v
@Nitin-x4v Жыл бұрын
at 8:05 i cant understand if an empty array is passed then hown can we say that the size inside the function will be 3?? can anyone tell me this?
@manishchandrapaneru.o5
@manishchandrapaneru.o5 6 ай бұрын
The most beautiful explanation ✅
@laginenisailendra1959
@laginenisailendra1959 2 жыл бұрын
May God bless you with all the health and wealth you need. I understood it.
@parthsalat
@parthsalat 2 жыл бұрын
Thanks a lot for this priceless video!
@Yash-uk8ib
@Yash-uk8ib 3 жыл бұрын
Sir, i can understand that i==n will be a base case but i>n will not happen.. as soon as i reaches n, it will return. I>=n is not making any sense to me. Correct me if I am wrong!!
@yashverma2986
@yashverma2986 3 жыл бұрын
Ha shi h tu bhi i==n hi shi h
@shauryatuli2241
@shauryatuli2241 3 жыл бұрын
I had the same doubt but I think the idea is i>= n (already contains i == n ) , the greater than sign is for extra precaution I guess or maybe because Bhaiya from the starting is teaching i>= n , in all his previous video ... maybe he want to show continuity in his code and teaching style
@Yash-uk8ib
@Yash-uk8ib 3 жыл бұрын
@@shauryatuli2241 ok
@nahidfaraji5069
@nahidfaraji5069 Жыл бұрын
No one can beat this Explanation.
@Highlights_Point
@Highlights_Point 2 жыл бұрын
Great Explanation sir i feel the recursion today
@aashapun6533
@aashapun6533 3 жыл бұрын
Thank you so much. Worthy Content!!
@anshvashisht8519
@anshvashisht8519 2 жыл бұрын
thank you so much for the recursive tree it helped a lot
@iamnottech8918
@iamnottech8918 3 ай бұрын
striver saved me he said remember it till the...... so when i was at gate of heaven they denied entry as i forgot it there so i got more time on earth to recap it , guys rules are very strict there. BE PREPARED 🤪
@_sf_editz1870
@_sf_editz1870 Жыл бұрын
java code : if (index >= n) { System.out.println(list); return; } // Include the current element in the subset list.add(arr[index]); printSub(arr, list, n, index + 1); // Exclude the current element from the subset list.remove(list.size() - 1); // Remove the last element (backtrack) printSub(arr, list, n, index + 1); }
@anishmishra4988
@anishmishra4988 Жыл бұрын
I have a little curious question that why to remove them later why not first make the recursive call without taking the element and then later add it then made the recursive call ? If Order is not Important of the sub-sequences.
@arohikarhade1954
@arohikarhade1954 5 ай бұрын
First of all, AMAZING and very helpful video. Thank you for all your effort. P.S. am I the only one who notices that he uses 'a couple of options' to tell us we have specifically 2 options. Not hating at all but I just got so confused at first haha.
@joeyaintwaffling
@joeyaintwaffling 3 жыл бұрын
Aur tarakki mile aapko bhai, kya samjhate ho
@sujalsamai6459
@sujalsamai6459 2 жыл бұрын
So useful video. Thanks 👍🙏
@mr.rexalan5576
@mr.rexalan5576 10 ай бұрын
I can understand the code, but i can't able to think recursively on my own to code. Is there any solution for this
@santhoshswamyv5627
@santhoshswamyv5627 9 ай бұрын
try to draw the recursive tree like him to get flow with the recursion
@brp3522
@brp3522 8 ай бұрын
Try and fail then google is the only way I was in your position but today I conquered the recursion wholly. All the best bud
@ritvi5717
@ritvi5717 2 жыл бұрын
amazing teacher thank you so much :)
@harshilsutariya1793
@harshilsutariya1793 Жыл бұрын
striver content 💥 >>>
@torishi82
@torishi82 7 ай бұрын
Bhai tum mahan ho. Samaj aa gaya.
@md.sahidulislam3152
@md.sahidulislam3152 2 жыл бұрын
You are the best....Love from Bangladesh
@PawanSingh-ck2jv
@PawanSingh-ck2jv 2 жыл бұрын
this code is giving output as 198 but bool value should only return 0 or 1. also i know that i can get correct output by using & variable as &s. #include using namespace std; bool palindraom(int i,int j,string s){ if(i>j)return 1; if(s[i]!=s[j])return 0; palindraom(i+1,j-1,s); } int main(){ string s="non"; bool k=palindraom(0,2,s); cout
@purushottamkumar3140
@purushottamkumar3140 2 жыл бұрын
Hats'Off to this Guy. Amazing
@muntajir646
@muntajir646 Жыл бұрын
THE BEST ON THE INTERNET
@debadityaghosh7612
@debadityaghosh7612 3 ай бұрын
Best explanation on internet ❤
@puranjanprithu6337
@puranjanprithu6337 2 жыл бұрын
the tree simplified everything...thanks man
@47BOT
@47BOT Ай бұрын
When i try to understand using dry run of recursive tree method then i understand it very well . But if i try to do dry step by step then i get confused...
L7. All Kind of Patterns in Recursion | Print All | Print one | Count
34:12
Re 5. Multiple Recursion Calls | Problems | Strivers A2Z DSA Course
16:45
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН
번쩍번쩍 거리는 입
0:32
승비니 Seungbini
Рет қаралды 182 МЛН
Lecture37: Recursion - Subsets / Subsequences of String [Theory + Code]
27:25
CodeHelp - by Babbar
Рет қаралды 343 М.
5 Secrets to Stop Stuttering & Speak More Clearly!
12:44
Vinh Giang
Рет қаралды 95 М.
Simon Sinek's Advice Will Leave You SPEECHLESS 2.0 (MUST WATCH)
20:43
Alpha Leaders
Рет қаралды 2,7 МЛН
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 358 М.
Re 4. Problems on Functional Recursion | Strivers A2Z DSA Course
19:48
take U forward
Рет қаралды 616 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
Fastest way to learn Data Structures and Algorithms
8:42
Sahil & Sarra
Рет қаралды 324 М.