Skip to content

Commit 8bbda51

Browse files
Merge pull request #1927 from CodingTestStudy2/변지협
[변지협] Day30
2 parents 630f70b + 3015e19 commit 8bbda51

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
'''
3+
1. 아이디어 :
4+
생각해보면 x좌표와 y좌표의 차이가 모두 짝수이거나 모두 홀수이면 도달 가능하다.
5+
6+
2. 시간복잡도 :
7+
o(1)
8+
9+
3. 자료구조/알고리즘 :
10+
'''
11+
class Solution:
12+
def canReach(self, start: list[int], target: list[int]) -> bool:
13+
x,y = start
14+
tx,ty = target
15+
16+
if abs(x - tx) % 2 == abs(y - ty) % 2:
17+
return True
18+
else:
19+
return False

0 commit comments

Comments
 (0)