7. Subsequences, Power Set using Recursion Code - Practise with me, understand code in detail! 🚀🔥
Vložit
- čas přidán 23. 07. 2022
- You can practise the question here-
bit.ly/3cqq0Dy
𝐃𝐨𝐧'𝐭 𝐜𝐥𝐢𝐜𝐤 𝐡𝐞𝐫𝐞- bit.ly/3PCiXWD
Subscribe and hit the notification icon to get notifications and learn with me everyday!! ❤️❤️
#dsa #softwaredeveloper #interviewpreparation
How does it feel to solve medium level recursion questions? ❤️
Visualization of recursive tree was little difficult? Having a high hope, after going through this series i will be more comfortable
@@cricketguru7596 let me know if you have any doubts. M here. You just watch the videos properly!
@@codefromscratch-keertipurswani yes sure
Now i am understanding more clearly and speed has increased a bit
The question is rated easy, but it seems like hard one 😅😅😅
I used to get scared using recursion. But these days I think recursion is fun it's all about recursive faith😂❤️
Yes the second catch was that we had to remove the empty string from the resultant vector as it is asked in the problem statement. Thank you Mam for great teaching!!!
Since I am your senior experience wise... I always follow your video the way you provide detail explanation...please keep motivating us
I have been waiting for this. Thank you thank you
Thanks for putting so much of efforts, to make us understand clearly :)
Great explanation mam👌gaining confidence day by day only because of you💪thankyou❤more power to you❤❤❤
I hope I can explain every DSA concept as easily as you do!!Looking forward to that day✌🤞
You will be able to! I am so sure ❤️
Thankyou didi for this wonderful explanation👌👍👌👍👌
Hi Keerthi,
These videos are really helpful. I have shared it with my friend and they subscribed to the channel. One suggestion, could you discuss time and space complexity for each of the problems that you are covering?
such a nice explanation ever
i could figure out the second catch easily, because keerti does not let us forget anything!!
Thank you so much mam! Solving a medium level rec. ques. feels great.👍
Yaaaay. Awesome Nidhi!
let goooo !!
💯🔥
I wrote it like a mix of iterative + recursive manner.
Please share your view point on the code.
void helper(List list, String s, String sChar, int total, int counter){
char [] charArray = s.toCharArray();
if(!list.isEmpty()){
int size = list.size();
for(int i =0; i
Thank You Mam..
Am still in binary search only i practice in weekends as I don have time is this normal to be this slow ??
Present 👍
Present 🔥
I have one doubt mam , after include helper get executed one time ,the next exclude helper should get executed.?
but in explanation according to my understanding after first helper reached to n , base condition is executing and then exclude helper.
Thank you
We found 8 number of subsequences but they ask for only 7 subsequences. The extra one is empty (" ").
I also write dii current . length is greater than zero than res.pushbackcurrent
🙋
Present ma'am 🤞
Present ma'am.
Present Ma'am
🙋♂️
Thanks for the video. In GFG, it is mentioned that the expected space complexity is O(n*2^n). Shouldn't the SC be just O(2^n) ?
Will cover this in a youtube short tomorrow. Should have talked about it. Thanks for pointing it out ❤️
Think of SC as an array of array, where total elems in the outer array are 2^N and each element(which is also an array of char aka string) can have max length of N. so SC will be size each elem * number of elems or O(N*2^N)
Present mam!!
Present ma'am
Day 19- present 🙋♂️
I was able to write code by myself. But your code is always more crisp.
Hi Nidhi, could you please drop a mail (just a hi would do) at workwithkeertipurswani@gmail.com
I am solving
Day 19🙋
Did anyone do this in JS ?
SUMMARY
=============================
Write code for including character and excluding character
Push "curr_subsequence" to "ans" when curr_idx == n
Another way to remove the empty string from "ans" is to pop_back before sorting
REASON: empty string will always be added to "ans" at last only
Alternative code
class Solution{
public:
void helper(string s, int curr_idx, int n, string curr_subsequence, vector &ans){
if(curr_idx == n){
ans.push_back(curr_subsequence);
return;
}
// include character
helper(s,curr_idx+1,n,curr_subsequence+s[curr_idx],ans);
// not include character
helper(s,curr_idx+1,n,curr_subsequence,ans);
}
vector AllPossibleStrings(string s){
vector ans;
helper(s,0,s.length(),"",ans);
ans.pop_back(); // remove empty string
sort(ans.begin(),ans.end());
return ans;
}
};
Present
Coding Prac Day 7 V3
Didi ...plz live stream ...
What should we discuss in live stream? Anything specific in mind?
@@codefromscratch-keertipurswani
'Mam' if we have any doubts ask in live stream and we connect to directly...🥰🥰
good
Present