Skip to content

Commit 6d8cf02

Browse files
Added README.md file for Longest Valid Parentheses
1 parent 3d016f6 commit 6d8cf02

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h2><a href="https://leetcode.com/problems/longest-valid-parentheses">Longest Valid Parentheses</a></h2> <img src='https://img.shields.io/badge/Difficulty-Hard-red' alt='Difficulty: Hard' /><hr><p>Given a string containing just the characters <code>&#39;(&#39;</code> and <code>&#39;)&#39;</code>, return <em>the length of the longest valid (well-formed) parentheses </em><span data-keyword="substring-nonempty"><em>substring</em></span>.</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong class="example">Example 1:</strong></p>
5+
6+
<pre>
7+
<strong>Input:</strong> s = &quot;(()&quot;
8+
<strong>Output:</strong> 2
9+
<strong>Explanation:</strong> The longest valid parentheses substring is &quot;()&quot;.
10+
</pre>
11+
12+
<p><strong class="example">Example 2:</strong></p>
13+
14+
<pre>
15+
<strong>Input:</strong> s = &quot;)()())&quot;
16+
<strong>Output:</strong> 4
17+
<strong>Explanation:</strong> The longest valid parentheses substring is &quot;()()&quot;.
18+
</pre>
19+
20+
<p><strong class="example">Example 3:</strong></p>
21+
22+
<pre>
23+
<strong>Input:</strong> s = &quot;&quot;
24+
<strong>Output:</strong> 0
25+
</pre>
26+
27+
<p>&nbsp;</p>
28+
<p><strong>Constraints:</strong></p>
29+
30+
<ul>
31+
<li><code>0 &lt;= s.length &lt;= 3 * 10<sup>4</sup></code></li>
32+
<li><code>s[i]</code> is <code>&#39;(&#39;</code>, or <code>&#39;)&#39;</code>.</li>
33+
</ul>

0 commit comments

Comments
 (0)