MINIMUM ADD TO MAKE PARENTHESIS VALID | PYTHON | LEETCODE # 921

Sdílet
Vložit
  • čas přidán 6. 03. 2022
  • In this video we are solving a popular Facebook interview question: Minimum Add to Make Valid Parenthesis. It's another one of these parenthesis questions that follows a similar pattern of needing to keep track of the l_count and r_count within the string and doing some processing based on the current status of the counts.
  • Věda a technologie

Komentáře • 8

  • @uniforcestelian7917
    @uniforcestelian7917 Před 2 lety

    This channel is extremely helpful for understanding how to approach LC medium to hard lvl problems. Thanks and I hope you continue to upload these helpful videos.

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

    this can also be done more cleanly IMO using a stack, but it would use O(n) space complexity vs this one that uses O(1)

  • @sreejitchatterjee4438
    @sreejitchatterjee4438 Před rokem +1

    Hey could you please link the video of the minimum remove parentheses? I couldn't find it on your channel

    • @crackfaang
      @crackfaang  Před rokem +1

      I’m on mobile and can’t link but in case you haven’t found it yet search for “facebooks #1 interview question” on my channel and you should find it. I think I named it “min. remove” instead of “minimum remove” to save space in the title

  • @hjlee3124
    @hjlee3124 Před 2 lety +1

    great explanation!!

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

    Why not just reduce the lcount, if it is greater than 0 when we encounter right parentheses?

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

    🎯 Key Takeaways for quick navigation:
    Greedy left tracking
    Balanced parentheses count
    Iterative string processing
    Made with HARPA AI