Solving the Valid Parenthesis Problem with 4 Solutions

This title was summarized by AI from the post below.
View profile for Matthew Simpson

Full Stack Web Developer & Movie Guy. I love HTML/CSS/JS/TS/NextJS and I can probably tell you the name of the actor in that film you liked

I wrote an in-depth look at the Valid Parenthesis Problem (LeetCode 0020) with four separate solutions. Starting with a full breakdown of the description, building out a basic solution, and then iterating toward three more concise solutions. I hope you find it interesting, useful, or both! https://lnkd.in/gW6ahjyv #Coding #LeetCode #CodingProblems #LeetCodeSolutions

  • text
Ejaz Pacheco

Senior Software Engineer @ VMO

1w

I remember doing this one. On my second attempt I ended up choosing the fourth option. I find that most of these challenges eventually come down to using while loops, sliding windows, and maps or sets to keep the time complexity efficient.

Mo Dhaliwal

CEO, Marketer, Technologist, Solver of Problems

1w

I thought I just solved this with one line of regex: \((?:[^()]*|(?R))*\) ...then realized I forgot about the other bracket types... and the nesting... and then I realized this one line of regex is wrong AND not useful 😂

See more comments

To view or add a comment, sign in

Explore content categories