Skip to content

Commit a1a7ec4

Browse files
Zanger67/leetcodeZanger67/leetcode
Zanger67/leetcode
authored and
Zanger67/leetcode
committedMar 12, 2025
Updated markdown files
1 parent bb307f1 commit a1a7ec4

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed
 

‎markdowns/Questions_By_Code_Length.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Calculations are based on the code files's byte sizes.
7272
| 959 | [Regions Cut By Slashes](<https://leetcode.com/problems/regions-cut-by-slashes>) | Medium | Daily | [solution](<_959. Regions Cut By Slashes.md>) | py | Aug 10, 2024 |
7373
| 1992 | [Find All Groups of Farmland](<https://leetcode.com/problems/find-all-groups-of-farmland>) | Medium | | [solution](<_1992. Find All Groups of Farmland.md>) | java, py | Jun 24, 2024 |
7474
| 142 | [Linked List Cycle II](<https://leetcode.com/problems/linked-list-cycle-ii>) | Medium | | [solution](<_142. Linked List Cycle II.md>) | py | Jun 26, 2024 |
75+
| 20 | [Valid Parentheses](<https://leetcode.com/problems/valid-parentheses>) | Easy | B75, N150 | [solution](<_20. Valid Parentheses.md>) | java | May 22, 2024 |
7576
| 2285 | [Maximum Total Importance of Roads](<https://leetcode.com/problems/maximum-total-importance-of-roads>) | Medium | Daily | [solution](<_2285. Maximum Total Importance of Roads.md>) | c, cpp, java, py | Jun 28, 2024 |
7677
| 1305 | [All Elements in Two Binary Search Trees](<https://leetcode.com/problems/all-elements-in-two-binary-search-trees>) | Medium | | [solution](<_1305. All Elements in Two Binary Search Trees.md>) | java | Jun 24, 2024 |
7778
| 143 | [Reorder List](<https://leetcode.com/problems/reorder-list>) | Medium | B75, N150 | [solution](<_143. Reorder List.md>) | java, py | Jun 11, 2024 |
@@ -168,7 +169,6 @@ Calculations are based on the code files's byte sizes.
168169
| 919 | [Complete Binary Tree Inserter](<https://leetcode.com/problems/complete-binary-tree-inserter>) | Medium | | [solution](<_919. Complete Binary Tree Inserter.md>) | py | Jul 05, 2024 |
169170
| 271 | [Encode and Decode Strings](<https://leetcode.com/problems/encode-and-decode-strings>) | Medium | B75, N150 | [solution](<_271. Encode and Decode Strings.md>) | py | Jun 13, 2024 |
170171
| 24 | [Swap Nodes in Pairs](<https://leetcode.com/problems/swap-nodes-in-pairs>) | Medium | | [solution](<_24. Swap Nodes in Pairs.md>) | c | Jun 07, 2024 |
171-
| 20 | [Valid Parentheses](<https://leetcode.com/problems/valid-parentheses>) | Easy | B75, N150 | [solution](<_20. Valid Parentheses.md>) | java | May 22, 2024 |
172172
| 1268 | [Search Suggestions System](<https://leetcode.com/problems/search-suggestions-system>) | Medium | | [solution](<_1268. Search Suggestions System.md>) | py | Jun 29, 2024 |
173173
| 1 | [Two Sum](<https://leetcode.com/problems/two-sum>) | Easy | B75, N150 | [solution](<_1. Two Sum.md>) | java, py | May 22, 2024 |
174174
| 622 | [Design Circular Queue](<https://leetcode.com/problems/design-circular-queue>) | Medium | | [solution](<_622. Design Circular Queue.md>) | py | Jul 06, 2024 |

‎markdowns/_20. Valid Parentheses.md

+38-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
> *First completed : May 22, 2024*
1010
>
11-
> *Last updated : July 01, 2024*
11+
> *Last updated : March 12, 2025*
1212
1313
------
1414

@@ -20,8 +20,45 @@
2020

2121
## Solutions
2222

23+
- [e20 v2.java](<../my-submissions/e20 v2.java>)
2324
- [e20.java](<../my-submissions/e20.java>)
2425
### Java
26+
#### [e20 v2.java](<../my-submissions/e20 v2.java>)
27+
```Java
28+
29+
class Solution {
30+
public boolean isValid(String s) {
31+
Stack<Character> temp = new Stack<>();
32+
33+
for (Character c : s.toCharArray()) {
34+
switch (c) {
35+
case '[' :
36+
case '{' :
37+
case '(' :
38+
temp.push(c);
39+
break;
40+
case ']' :
41+
if (temp.isEmpty() || temp.pop() != '[')
42+
return false;
43+
break;
44+
case '}' :
45+
if (temp.isEmpty() || temp.pop() != '{')
46+
return false;
47+
break;
48+
case ')' :
49+
if (temp.isEmpty() || temp.pop() != '(')
50+
return false;
51+
break;
52+
default:
53+
break;
54+
}
55+
}
56+
57+
return temp.isEmpty();
58+
}
59+
}
60+
```
61+
2562
#### [e20.java](<../my-submissions/e20.java>)
2663
```Java
2764
class Solution {

0 commit comments

Comments
 (0)