Skip to content

Commit 8e34e53

Browse files
committed
Update solution 020 [Python3]
1 parent 9f6878f commit 8e34e53

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": "/usr/bin/python3"
3+
}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Solution:
2+
def isValid(self, s):
3+
"""
4+
:type s: str
5+
:rtype: bool
6+
"""
7+
a="()"
8+
b="[]"
9+
c="{}"
10+
f=False
11+
if s == '':
12+
return True
13+
while s != '':
14+
s=s.replace(a,'')
15+
s=s.replace(b,'')
16+
s=s.replace(c,'')
17+
if s == '':
18+
f=True
19+
return f
20+
if (a in s) or (b in s) or (c in s):
21+
pass
22+
else:
23+
f=False
24+
return f

0 commit comments

Comments
 (0)