Trains the technique from
LeetCode 780Reaching PointsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A pair of whole numbers starts as (sx, sy). One step replaces the pair either by its first number plus its second alongside the second, or by the first alongside the first plus the second.
Return true when some sequence of steps turns the starting pair into (tx, ty).
Example 1
From 1 and 1, growing the second gives 1 and 2, then growing the first gives 3 and 2.
Example 2
Any step from 1 and 1 makes the two numbers different, and no later step can bring them level again, so an equal pair is out of reach.
Example 3
Growing the first number by the second takes 2 and 2 straight to 4 and 2.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def reaching_points(sx: int, sy: int, tx: int, ty: int) -> bool:public boolean reachingPoints(int sx, int sy, int tx, int ty)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.