Leetcode 796 Solution
This article provides solution to leetcode question 796 (reaching-points)
Access this page by simply typing in "lcs 796" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/reaching-points
Solution
class Solution:
    def reachingPoints(self, sx: int, sy: int, tx: int, ty: int) -> bool:
        if sx > tx or sy > ty:
            return False
        if sx == tx and (sy - ty) % tx == 0:
            return True
        if sy == ty and (sx - tx) % ty == 0:
            return True
        if tx >= ty:
            return self.reachingPoints(sx, sy, tx % ty, ty)
        else:
            return self.reachingPoints(sx, sy, tx, ty % tx)
        return False