diff --git a/PARTICIPANTS.md b/PARTICIPANTS.md index 5a2e2f4..a43dcf7 100644 --- a/PARTICIPANTS.md +++ b/PARTICIPANTS.md @@ -142,3 +142,15 @@ - šŸ”­ Connect with me: **[Piyushjar](https://github.com/piyushjar))** --- + +--- +### Connect with me: + + + +- šŸ‘Øā€šŸ’» My name is **Vinayak Jaiswal** +- 🌱 I’m a FullStack Developer. +- šŸ“« Reach me: **vinayakjaiswal48@gmail.com** +- šŸ”­ Connect with me: **[Vinayakjaiswal07](https://github.com/Vinayakjaiswal07)** + +--- diff --git a/python/32-Longest-Valid-Parentheses.py b/python/32-Longest-Valid-Parentheses.py new file mode 100644 index 0000000..dfa0c0f --- /dev/null +++ b/python/32-Longest-Valid-Parentheses.py @@ -0,0 +1,15 @@ +class Solution: + def longestValidParentheses(self, A: str) -> int: + s=[-1] + m=0 + for i in range(len(A)): + if A[i]=='(': + s.append(i) + + else: + s.pop() + if not s: + s.append(i) + else: + m=max(m,i-s[-1]) + return m \ No newline at end of file