Recursively remove all adjacent duplicates | Recursion | C++

  Рет қаралды 10,038

Ayushi Sharma

Ayushi Sharma

Күн бұрын

Пікірлер: 37
@xanderash4574
@xanderash4574 2 жыл бұрын
mam, the problem which was given and the code u've explained is entirely different....the first example u have taken is "abzxxab"...the output should be "abzab" but not "abzxab"
@conceptsimpleeasycse1550
@conceptsimpleeasycse1550 Ай бұрын
@raghavagrawal6263
@raghavagrawal6263 2 жыл бұрын
Hello mam, The first the problem you told in video and the link of which you have given is a little bit different from the one we have solved in this. Please explain the recursive approach for removing all duplicates because in that we have to match with prev one also.
@yogeshsikanderpuriya7417
@yogeshsikanderpuriya7417 3 жыл бұрын
ayushi the question u reading gfg and the question u r solving on on gfg practice both are different.
@AyushiSharmaDSA
@AyushiSharmaDSA 3 жыл бұрын
Yes, question is wrong given in practice section in gfg😅
@ShivRaj00009
@ShivRaj00009 2 жыл бұрын
Really create explanation you made recursion concept very simple by those 3 steps
@AyushiSharmaDSA
@AyushiSharmaDSA 2 жыл бұрын
Thank you Shiv, glad it was helpful :)
@Swaroop_Rath
@Swaroop_Rath 3 жыл бұрын
Hey Ayushi, First of all, thank u so much for such an amazing and quick response. Just one thing I want to mention is, the problem which you have coded on gfg practice is an easy one, but kindly check the one which is given on gfg page itself. It is saying to remove all adjacent duplicates, like complete removal of that character. Eg: i/p: abxxb o/p: a (This is because x is duplicate so completely removed it, then after removing x we are left with the string "abb" so now b is duplicate so completely remove b and then our final string becomes "a" and thus o/p:a).
@AyushiSharmaDSA
@AyushiSharmaDSA 3 жыл бұрын
Ohh😅, I will try to make video on that asap✌🏻.
@Swaroop_Rath
@Swaroop_Rath 3 жыл бұрын
@@AyushiSharmaDSA Sure Ayushi... Will be waiting for another extra-ordinary explanation. 😃
@AyushiSharmaDSA
@AyushiSharmaDSA 3 жыл бұрын
@@Swaroop_Rath 😊thanks
@Swaroop_Rath
@Swaroop_Rath 3 жыл бұрын
Most welcome 😄
@ashutoshshakya5321
@ashutoshshakya5321 3 жыл бұрын
but the output is "ay" for input "azxxzy"
@pycharm_boy4344
@pycharm_boy4344 3 жыл бұрын
Very good explanation
@AyushiSharmaDSA
@AyushiSharmaDSA 3 жыл бұрын
Thank you. 😀 Please share the channel with your friends and juniors 🙏🏻🙌🏻
@sunnykakrani7830
@sunnykakrani7830 3 жыл бұрын
hey ayushi can u pls tell me why my recursive code is giving TLE on GFG . string solve(string s,int i,int size) { if(i==size-1) { string res=""; res+=s[i]; return res; } string res=solve(s,i+1,size); if(res[0]==s[i]) return res; else { string new_string=s[i]+res; return new_string; } } string removeConsecutiveCharacter(string S) { return solve(S,0,S.size()); }
@anweshangoswami5636
@anweshangoswami5636 2 жыл бұрын
Hey Aayushi, that's very nicely explained. Just one suggestion:- When you are explaining the code 2nd time on gfg portal, you may rather try explaining by taking the snapshot of the code, paste it in front of the dry run and then explain...maybe that would help us to relate better. But thanks again✌
@AyushiSharmaDSA
@AyushiSharmaDSA 2 жыл бұрын
Sure, thanks. I willing keep in mind :)
@kartikkk4583
@kartikkk4583 2 жыл бұрын
nice explanation
@AyushiSharmaDSA
@AyushiSharmaDSA 2 жыл бұрын
Thanks😊
@UCSAkhilPrasad
@UCSAkhilPrasad Жыл бұрын
Kindly Check the volume. as it is too low
@souravmallick8814
@souravmallick8814 3 жыл бұрын
Thank you.
@AyushiSharmaDSA
@AyushiSharmaDSA 3 жыл бұрын
Welcome. Glad it helped :)
@RAUSHANKUMAR-iq4yj
@RAUSHANKUMAR-iq4yj 2 жыл бұрын
Thanks❤🌹🙏
@AyushiSharmaDSA
@AyushiSharmaDSA 2 жыл бұрын
Welcome 🤗
@ranjitkoragoankar
@ranjitkoragoankar 3 жыл бұрын
Thank You
@AyushiSharmaDSA
@AyushiSharmaDSA 3 жыл бұрын
Welcome :). Glad you found it useful :)
@mrinalmadhav8119
@mrinalmadhav8119 3 жыл бұрын
Mam aap company wise questions lijiye pls
@akashchourasiya72
@akashchourasiya72 2 жыл бұрын
explain aaa = "" your output is a and i want empty string
@animeshsingh3699
@animeshsingh3699 3 жыл бұрын
I tried this way: void removeDuplicates(string str, int index, char prev, string &res) { if(index == str.size()) return; if(str[index] != prev) { res.push_back(str[index]); removeDuplicates(str, index+1, str[index], res); } else removeDuplicates(str, index+1, str[index], res); } int main() { string str = "aaaabccdsxx"; string res=""; res.push_back(str[0]); removeDuplicates(str, 1, str[0], res); cout
@AyushiSharmaDSA
@AyushiSharmaDSA 3 жыл бұрын
Okay, checking. I will let you know
@deepjyotipator3962
@deepjyotipator3962 2 жыл бұрын
Can you please change your video name to exactly which problem you actually solved? You are just misleading by giving name of a hard problem and solving for a basic problem.
@yupp_harish3936
@yupp_harish3936 3 жыл бұрын
hi ayushi i have one doubt
@AyushiSharmaDSA
@AyushiSharmaDSA 3 жыл бұрын
Yes harish go ahead
@yupp_harish3936
@yupp_harish3936 3 жыл бұрын
yar ese q kaise ayenge apne ko
@abhisheksamari4591
@abhisheksamari4591 2 жыл бұрын
0.02 seconds solution string removeConsecutiveCharacter(string S) { // code here. // int p = 0; string str = ""; char l; str+=S[0]; int p = 1; for(int i = 1;i
Remove Invalid Parentheses | Leetcode 301 | C++
15:58
Ayushi Sharma
Рет қаралды 11 М.
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,2 МЛН
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,6 МЛН
Harder Than It Seems? 5 Minute Timer in C++
20:10
The Cherno
Рет қаралды 215 М.
10 FORBIDDEN Sorting Algorithms
9:41
Ardens
Рет қаралды 922 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 834 М.