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 f848beb commit 4d49d49Copy full SHA for 4d49d49
valid-parentheses/forest000014.java
@@ -9,6 +9,10 @@ class Solution {
9
public boolean isValid(String s) {
10
Stack<Character> st = new Stack<>();
11
12
+ if (s.length() % 2 == 1) {
13
+ return false;
14
+ }
15
+
16
for (char ch : s.toCharArray()) {
17
if (ch == '(' || ch == '{' || ch == '[') {
18
st.push(ch);
0 commit comments