FastPrepReaching Points
Problems/Reaching Points

Reaching Points

Goldman Sachs logoGoldman Sachs● HardFULLTIMEOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: A Goldman Sachs HackerRank assessment report links the exact Reaching Points exercise and says the test cases matched. This practice version is an approximately 99% match.

Start at the positive coordinate (sx, sy). In one move, replace it with either (sx + sy, sy) or (sx, sx + sy).

Return whether some sequence of moves reaches (tx, ty).

Function

reachingPoints(sx: int, sy: int, tx: int, ty: int) → boolean

Examples

Example 1

sx = 1sy = 1tx = 3ty = 5return = true

(1,1) can move to (1,2), then (3,2), then (3,5).

Example 2

sx = 1sy = 1tx = 2ty = 2return = false

Neither legal move can produce (2,2).

Constraints

  • 1 <= sx, sy, tx, ty <= 10^9

More Goldman Sachs problems

  • Palindrome CounterOA · Seen Oct 2026
  • Palindrome CounterOA · Seen Oct 2026
  • Longest Palindromic SubsequenceOA · Seen Oct 2026
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
public boolean reachingPoints(int sx, int sy, int tx, int ty) {
  // write your code here
}
Checking account…