1249. Minimum Remove to Make Valid Parentheses | Stack | 4 ways

Sdílet
Vložit
  • čas přidán 7. 09. 2024

Komentáře • 19

  • @ARYANMITTAL
    @ARYANMITTAL  Před 5 měsíci +4

    Hi Gys, Video is long, if you want to Jump to most Optimal Solution pls go from Approach 2 -directly-> Approach4 (Only 2 Approaches)
    If you want to understand reversing strategy in Paranthesis problem -> Approach3
    Basic Human Approach -> Approach1
    I don't want to waste your time, so pls jump to specific Approaches you like ❤
    New VIDEO - czcams.com/video/uXIXVKDnHX0/video.htmlsi=R89M32F_p2HNheUs

  • @steverogers7050
    @steverogers7050 Před 3 měsíci

    Great Explanation Bro ....amazed to see you explaining such things at this age keep it up bro

  • @ravindrakanchu7504
    @ravindrakanchu7504 Před 5 měsíci

    Love u bro u 💗

  • @THOSHI-cn6hg
    @THOSHI-cn6hg Před měsícem +1

    we could use a two pointer approach too - , which would be a one pass solution

  • @codingkart245
    @codingkart245 Před 5 měsíci

    Your intuitive way of explaining things is just awesome!!! Please don't stop making videos like this of daily leetcode challanges!

  • @A_Myth963
    @A_Myth963 Před 5 měsíci

    Bro last Solution was 🔥

  • @kgjr.6224
    @kgjr.6224 Před 5 měsíci +3

    I Usually Solve the Question and then come here to get the Optimal Solution.

  • @elliotalderson9517
    @elliotalderson9517 Před 5 měsíci

    based Aryan, the Austrian painter was rigth

  • @ITACHIUCHIHA-dr8sz
    @ITACHIUCHIHA-dr8sz Před 5 měsíci

    We can also use the string::operator+=, which is overloaded for chars and internally calls to the push_back() function.

    • @ARYANMITTAL
      @ARYANMITTAL  Před 5 měsíci

      Yes sir, but just be cautious on char* or string, then this won’t be calling pushback, but yeah for characters it works same🔥🫡

  • @joychoudhury175
    @joychoudhury175 Před 5 měsíci +1

    hi, Aryan! in approach 4 if we traverse the string backward and move "(" until dif is 0, will it work?

  • @karanwagh4829
    @karanwagh4829 Před 5 měsíci

    Hi Aryan, as you said that ans+=char takes O(n) operation in java and c++ too but as I code in java I thing there is no other option to append character at back. If you know pls can you mention it.

    • @ARYANMITTAL
      @ARYANMITTAL  Před 5 měsíci +1

      Nhi nhi sir, ans += c will take o(1) but same is not true for string, as ans += c in cpp internally calls push back only, same ig works in java too, but so as to mot get confused & mistakenly use += with strings, i always recommend using push_back

    • @karanwagh4829
      @karanwagh4829 Před 5 měsíci

      @@ARYANMITTAL Ok thanks.

    • @karanwagh4829
      @karanwagh4829 Před 5 měsíci

      @@ARYANMITTAL Ok Thanks now It's clear.

    • @WiFiWaLaaa
      @WiFiWaLaaa Před 4 měsíci

      @@ARYANMITTAL area bhai buT JAVA mai kai hota hai (jasea C++ mai hota hai `push_back` for strings) vasea ?