Skip to content

Commit bcdede3

Browse files
authored
Create reaching-point.py
1 parent 90608da commit bcdede3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

reaching-point.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution:
2+
"""
3+
@param start: a point [x, y]
4+
@param target: a point [x, y]
5+
@return: return True or False
6+
"""
7+
def ReachingPoints(self, start, target):
8+
# write your code here
9+
while start != target:
10+
if (target[0] < start[0]) or (target[1] < start[1]):
11+
return False
12+
if target[0] < target[1]:
13+
target[1] -= target[0]
14+
else:
15+
target[0] -= target[1]
16+
return True

0 commit comments

Comments
 (0)