← All problemsSign in

Traversing Grid

Given 2 points in 2 dimensional space (xs,ys) and (xd,yd), your task is to find whether (xd,yd) can be reached from (xs,ys) by making a sequence of zero or more operations. From a given point (x, y), the operations possible are: a) Move to point (y, x) b) Move to point (x, -y) c) Move to point (x+y, y) d) Move to point (2*x, y) Input The first line of input contains T, the number of test

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start