Skip to content

Commit 60a0e9f

Browse files
committed
Runtime: 460 ms (Top 26.24%) | Memory: 15.4 MB (Top 86.61%)
1 parent 7a94d7f commit 60a0e9f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/algorithms/C/Check if a Parentheses String Can Be Valid/Check if a Parentheses String Can Be Valid.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Runtime: 460 ms (Top 26.24%) | Memory: 15.4 MB (Top 86.61%)
12
class Solution:
23
def canBeValid(self, s: str, locked: str) -> bool:
34
def validate(s: str, locked: str, op: str) -> bool:
@@ -10,4 +11,4 @@ def validate(s: str, locked: str, op: str) -> bool:
1011
if wild + bal < 0:
1112
return False
1213
return bal <= wild
13-
return len(s) % 2 == 0 and validate(s, locked, '(') and validate(s[::-1], locked[::-1], ')')
14+
return len(s) % 2 == 0 and validate(s, locked, '(') and validate(s[::-1], locked[::-1], ')')

0 commit comments

Comments
 (0)