2 parents 5420ac1 + e0a3197 commit c8603d5Copy full SHA for c8603d5
1 file changed
leetcode3/남효정/3996. Even Number of Knight Moves.py
@@ -0,0 +1,7 @@
1
+# 풀이 실패
2
+# 나이트는 1번 움직일 때마다 무조건 현재 칸과 다른 색의 칸으로 감
3
+# 따라서 짝수 번 움직이면 원래 색으로 돌아감
4
+# x + y 좌표 합의 홀짝으로 칸의 색상을 알 수 있음
5
+class Solution:
6
+ def canReach(self, start: list[int], target: list[int]) -> bool:
7
+ return (start[0] + start[1]) % 2 == (target[0] + target[1]) % 2
0 commit comments