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​

Комментарии • 18

  • @aaryachoudhary7949
    @aaryachoudhary7949 Месяц назад +3

    That second approach is crazy!!!🔥

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  Месяц назад +3

    Like target of today's videos is 90. Please do like if you understood the solution 😊

  • @Anuragsharma056
    @Anuragsharma056 Месяц назад

    Nice approach and quality of teaching 🎉

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh Месяц назад +1

    Thanks 😊

  • @GirjeshSharma-zv3xo
    @GirjeshSharma-zv3xo Месяц назад +3

    love from russia❤

  • @anishmangal9072
    @anishmangal9072 Месяц назад

    Nice Explanation.

  • @SulemanbhashaDodmni
    @SulemanbhashaDodmni Месяц назад

    Due to your previous videos i alredy solved this question and now watching for optimal aproch .
    love you

  • @yashmatlani1976
    @yashmatlani1976 Месяц назад +2

    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

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  Месяц назад +1

      @@yashmatlani1976 impressive 👏 👌 great progress ✨️

  • @arnab027
    @arnab027 Месяц назад

    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.

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  Месяц назад

      String manipulation java me slow hota hai.. StringBuilder se try krlo instead of string, thoda better hoga but not very efficient.

  • @Nishant89-i2z
    @Nishant89-i2z Месяц назад +2

    2 nd approach puri soch hi nahi sakta

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd Месяц назад +2

    First view sir

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd Месяц назад

    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

  • @manideepsingh8035
    @manideepsingh8035 Месяц назад

    was able to think only even and odd cases uske baad approach he nhi bana😄

  • @maniprakash6960
    @maniprakash6960 Месяц назад +2

    Sir, please explain in English

  • @manabdebnath6223
    @manabdebnath6223 Месяц назад

    Dark mode par dry run kijiye na, aakh par dard hota hai