mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	国外版
This commit is contained in:
		
							
								
								
									
										38
									
								
								算法题(国外版)/valid-parentheses.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								算法题(国外版)/valid-parentheses.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
<p>Given a string <code>s</code> containing just the characters <code>'('</code>, <code>')'</code>, <code>'{'</code>, <code>'}'</code>, <code>'['</code> and <code>']'</code>, determine if the input string is valid.</p>
 | 
			
		||||
 | 
			
		||||
<p>An input string is valid if:</p>
 | 
			
		||||
 | 
			
		||||
<ol>
 | 
			
		||||
	<li>Open brackets must be closed by the same type of brackets.</li>
 | 
			
		||||
	<li>Open brackets must be closed in the correct order.</li>
 | 
			
		||||
</ol>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Example 1:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> s = "()"
 | 
			
		||||
<strong>Output:</strong> true
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 2:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> s = "()[]{}"
 | 
			
		||||
<strong>Output:</strong> true
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 3:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> s = "(]"
 | 
			
		||||
<strong>Output:</strong> false
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Constraints:</strong></p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
	<li><code>1 <= s.length <= 10<sup>4</sup></code></li>
 | 
			
		||||
	<li><code>s</code> consists of parentheses only <code>'()[]{}'</code>.</li>
 | 
			
		||||
</ul>
 | 
			
		||||
		Reference in New Issue
	
	Block a user