8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fced9a9 commit 342c295Copy full SHA for 342c295
README.md
@@ -4,6 +4,26 @@ List is periodically updated
4
5
## LeetCode
6
7
+### #20 Valid Parentheses
8
+```
9
+var isValid = function(s) {
10
+ let stack = [];
11
+
12
+ for(let i = 0; i < s.length; i++){
13
+ if(s[i] == '('){
14
+ stack.push(')');
15
+ } else if (s[i] == '{'){
16
+ stack.push('}');
17
+ } else if (s[i] == '['){
18
+ stack.push(']');
19
+ } else if (stack.pop() !== s[i]){
20
+ return false
21
+ }
22
23
+ return !stack.length
24
+};
25
26
27
### #14 Longest Common Prefix
28
```
29
0 commit comments