Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
631 views
in Online Assessments by Expert (46,090 points) | 631 views

1 Answer

0 like 0 dislike

Question: 2
There is a grid of (10^18, 10^18) blocks. The person standing on (i, j) block can move to (2i, j) or (i, 2j) or (i-j, j) or(i, j-i) inside the grid. If he starts from (1, 1) output "Yes" if he/ she could reach (m, n) block else output "No"

 

Input:
t: No of m, n values
List of 2 m, n values

 

Output:
t Yes or No

 

Ex:
Input:
3
1 2
4 7
10 10

Output: 
Yes
Yes
No
by Expert (46,090 points)