Skip to content

Commit

Permalink
[코딩테스트책] 4-1. 상하좌우(#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
heerucan committed Jan 3, 2022
1 parent 394f3c0 commit 756cd88
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CodingTest/CH4 구현/4-1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

for i in range(len(direction)):
if direction[i] == 'R':
if x == n:
if y == n:
y += 0
else:
y += 1

elif direction[i] == 'L':
if x == 1:
if y == 1:
y += 0
else:
y -= 1
Expand All @@ -25,9 +25,10 @@
x -= 1

elif direction[i] == 'D':
if y == n:
if x == n:
x += 0
else:
x += 1


print(x, y)

0 comments on commit 756cd88

Please sign in to comment.