Skip to content

Commit 757b5e3

Browse files
committed
0657 - Solution.py
1 parent 685c0e1 commit 757b5e3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class Solution:
2+
def judgeCircle(self, moves):
3+
"""
4+
:type moves: str
5+
:rtype: bool
6+
"""
7+
8+
x = 0
9+
y = 0
10+
for each in moves:
11+
if( each == 'U' ):
12+
y += 1
13+
elif( each == 'D' ):
14+
y -= 1
15+
elif( each == 'R' ):
16+
x += 1
17+
elif( each == 'L' ):
18+
x -= 1
19+
20+
return x == y == 0

0 commit comments

Comments
 (0)