8000 Update README.md · abroroo/leetcode@342c295 · GitHub
[go: up one dir, main page]

Skip to content

Commit 342c295

Browse files
authored
Update README.md
1 parent fced9a9 commit 342c295

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ List is periodically updated
44

55
## LeetCode
66

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+
```
727
### #14 Longest Common Prefix
828
```
929

0 commit comments

Comments
 (0)
0