Reaching Points
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Starting from a point (x, y), one move replaces it with either (x + y, y) or (x, x + y).
Given a start (sx, sy) and a target (tx, ty), all positive integers, return true if the target can be reached from the start using zero or more moves, and false otherwise.
Coordinates go up to 10^9, so searching forward from the start is far too slow.
Examples
Constraints
- `1 <= sx, sy, tx, ty <= 10^9`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.