Determine Whether One Point Can Reach Another
Company: NVIDIA
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: hard
Interview Round: Technical Screen
# Determine Whether One Point Can Reach Another
You start at a point `(sx, sy)` with positive integer coordinates. From `(x, y)`, one move may transform the point into either:
- `(x + y, y)`, or
- `(x, x + y)`.
Given positive integers `sx`, `sy`, `tx`, and `ty`, return whether the target `(tx, ty)` is reachable from the start.
Implement:
```python
def solve(sx: int, sy: int, tx: int, ty: int) -> bool:
...
```
## Constraints
- `1 <= sx, sy, tx, ty <= 10^18`
## Examples
```text
(1, 1) -> (3, 5) = True
(1, 1) -> (2, 2) = False
(3, 7) -> (3, 7) = True
```
Quick Answer: Determine whether a target point with positive integer coordinates can be reached from a starting point using two coordinate-addition moves. Account for values as large as 10^18, targets equal to the start, impossible coordinate relationships, and exact reachability.