Subsets | Simple Story To Code | Leetcode 78 | Recursion Concepts And Questions | Video 17
VloĆŸit
- Äas pĆidĂĄn 28. 07. 2024
- iPad PDF Notes - github.com/MAZHARMIK/Intervie...
Whatsapp Community Link : www.whatsapp.com/channel/0029...
This is the 17th video of our playlist "Recursion Concepts And Questions". Find the Details below :
Video Name : Subsets | Simple Story To Code | Leetcode 78 | Recursion Concepts And Questions
Video # : 17
C++/Java Code Link : github.com/MAZHARMIK/Intervie...
Leetcode Link : leetcode.com/problems/subsets/
GfG Problem Link : www.geeksforgeeks.org/problem...
Note that we can also solve this using Bit-Magic which will be done in our Bit-Magic playlist.
đ Unraveling Recursion: A Journey into the Depths of Code
đ„ Welcome to the 17th Video of my Recursion Playlist! đ In this enlightening video, we will solve a very famous recursion/backtracking problem "Subsets" with the help of Recursion. We will start with a Simple story understanding the problem by making a simple choice Diagram and then we will be Converting Story to code and writing the recursive code for the problem and also I will also be explaining the Time and Space Complexity of the code đ
đ What's Inside?
đ Simple story understanding with Subsets generation with a Choice Tree Diagram
đ Converting Story to code and writing the recursive code for Subsets generation
đ Explanation of Time and Space Complexity of the code
đ©âđ» Who Should Watch?
This playlist is for everyone but best suited for Freshers who are new to Recursion.
đ Embark on the Recursive Adventure Now!
My DP Concepts Playlist : âą Roadmap for DP | How t...
My Graph Concepts Playlist : âą Graph Concepts & Qns -...
My GitHub Repo for interview preparation : github.com/MAZHARMIK/Intervie...
Subscribe to my channel : / @codestorywithmik
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
Approach Summary : The approach used in the provided Java code is a recursive backtracking algorithm to generate all possible subsets of an input array. The algorithm explores two possibilities at each step: including or excluding the current element. This is achieved through the solve method, which, when called with a specific index, either adds the current element to the subset and makes a recursive call or skips the current element and proceeds with another recursive call. The base case terminates the recursion when the index exceeds the length of the array. The subsets are stored in the result list, and the space complexity is O(2^N) due to the storage of all possible subsets. The recursion stack space complexity is O(N), where N is the length of the input array, as each recursive call adds a new level to the call stack, and the depth of recursion is equal to the length of the array.
âââŠâââŠââââŠââŠâŠâŠâŠââââ
âââŁâââââŁââŁââŁââŁâââŁââŁ
â âââââââ ââââŁâââââââŁ
âââ©âââ©ââ©ââ©ââ©âââ©ââ©ââ
âš Timelinesâš
00:00 - Introduction
0:09 - Motivation (Bhashan)
0:47 - Problem Explanation
1:56 - Options = Recursion
3:08 - Tree Diagram
7:46 - Time & Space Analysis from Tree Diagram
12:22 - Recursion Magic - Trust (story to code)
16:17 - What if we had duplicates
20:17 - Coding Live on Leetcode
#codestorywithMIK
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyear #RecursionExplained #CodingJourney #Programming101 #TechTalks #AlgorithmMastery #Recursion #Programming #Algorithm #Code #ComputerScience #SoftwareDevelopment #CodingTips #RecursiveFunctions #TechExplained #ProgrammingConcepts #CodeTutorial #LearnToCode #TechEducation #DeveloperCommunity #RecursiveThinking #ProgrammingLogic #ProblemSolving #AlgorithmDesign #CSEducation
came here to learn about subsets
solved today problem of the day!
Awesome đđ»
@@codestorywithMIK sir subset with duplicates vala ki video bna di jiye plz
Thank you so much mik.
I wanted to let you know, me and my friends are learning from your playlists and we play it on speaker and everyone sits and listen and make notes. Thank you so much again for doing so much for us.
upload the video for duplicate elements also sir helpful for us
Never stopppp working sirâ€â€â€we are greatfull to have you
Best thing i Got this yearâ€
Sir, why here temp.pop_back() is not given after the second recursive call? but given in 'generate paranthesis' question? When I removed the second pop back from generate paranthesis qn , it is not working. what is the difference between these two?
Similar aayega to ek set bna lenge aur last me phir set ko vector me convert kar do that is the approach
Additionally, I enjoy watching your videos. They provide really good explanations. Thanks a lot for your efforts.
Your consistency is on another level.
sir ek code ka dry run bhi kraa dete to or achay say smjh aata..btw thank you đŻđ
Hi there.
Feedback taken . I will take care of this thing in mind for future videos â€ïžđ
Thanks a lot bhaiya â€â€
i request you to complete the series ,dont put this on hold or stop the series.
Amazing video as always
yes please
Exceptional Teaching â€â€
â€ïžđ
What you did for not selecting a duplicate subset ? I m confused
bro keep making video like this
maza aagya yrr
one error temp.add(nums[i]);
Sir please make of today's GFG potd
Take hint from this video. It will help to build the intuition for that also
Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree | Broken in Steps | Leetcode-1489
czcams.com/video/gDPh7gsK3F8/video.html
Let me know if that helps
Bhaiya @@codestorywithMIKpermutation 2 (leetcode 47) me bhi add kar do es series me plsđđ»đđ»đđ»
I m here to watch your videos but disappointed because language is Hindiđą
Apologies for the inconvenience đ„șâčïž
code for duplicate.
public Listsubset WithDup(int[]nums){
Listans=new ArrayList();
Arrays.sort(nums);
backtrack(0,ans,new ArrayList(),nums);
return ans;
}
private void backtrack(int idx,Listans,Listtemp,int[]nums){
ans.add(new ArrayList(temp));
for(int i=idx;i0&&nums[i]==nums[i-1]) continue;
backtrack(i+1,ans,temp,nums);
temp.remove(temp.size()-1);
}
}
đâ€