1190. Reverse Substrings Between Each Pair of Parentheses | Leetcode Daily Challlenge | DSA | Hindi
HTML-код
- Опубликовано: 22 авг 2024
- Problem Name:
1190. Reverse Substrings Between Each Pair of Parentheses
Problem Statement:
You are given a string s that consists of lower case English letters and brackets.
Reverse the strings in each pair of matching parentheses, starting from the innermost one.
Your result should not contain any brackets.
Problem Link:
leetcode.com/p...
Graph Playlist:
• Graph Data Structure S...
Java Plus DSA Placement Course Playlist:
• Java and DSA Course Pl...
Java Plus DSA Sheet:
docs.google.co...
Notes:
github.com/Tiw...
Telegram Link:
shashwattiwari...
Ultimate Recursion Series Playlist:
• Recursion and Backtrac...
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari...
Samsung Interview Experience:
• I cracked Samsung | SR...
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding #problemsolving
That second approach is crazy!!!🔥
Like target of today's videos is 90. Please do like if you understood the solution 😊
Nice approach and quality of teaching 🎉
Thanks 😊
love from russia❤
Nice Explanation.
Due to your previous videos i alredy solved this question and now watching for optimal aproch .
love you
I Had a slightly different approach to this question . Instead of storing characters in stack , i maintained the index of last opening bracket whenever i encountered a closing one . and used a reverse function and made the recursive calls
Below is my Code with Linear TC
class Solution {
string recur(string s,int idx,string res){
if(idx>=s.length()){
string final_ans = "";
for(char i : res){
if(i=='(' || i == ')') continue;
final_ans += i;
}
return final_ans;
}
if(s[idx]=='(') {
s1.push(idx+1);
}
if(s[idx]==')') {
res = Rev(res,s1.top(),idx-1);
s1.pop();
}
return recur(s,idx+1,res+s[idx]);
}
string Rev(string s1,int s,int e){
while(s
@@yashmatlani1976 impressive 👏 👌 great progress ✨️
my approach was quite similar with your first approach ,only difference is that i didnt take any list i just considered a dummy string and manipulated it multiple times,but at last shocked by seeing n^2 complexity thatys why i was waiting for your video.
String manipulation java me slow hota hai.. StringBuilder se try krlo instead of string, thoda better hoga but not very efficient.
2 nd approach puri soch hi nahi sakta
First view sir
3:30 - Stack Approach
10:11 - Code for stack
13:27 - Approach 2 ( jo mai sapne me thanos ban kr sare infinity stones lekr bhi khud se nahi soch pata )
23:45 - Code for Approach 2
was able to think only even and odd cases uske baad approach he nhi bana😄
Sir, please explain in English
Dark mode par dry run kijiye na, aakh par dard hota hai
@@manabdebnath6223 okay 👍