GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 29 June 2022

[Solution] Change Row and Column Both CodeChef Solution


There is a 10×10 grid with rows numbered 1 to 10 from top to bottom, and columns 1 to 10 from left to right. Each cell is identified by a pair (r,c) which means that the cell is located at row r and column c.

If Chef's current location is (a,b), then in one move Chef can go to (c,d) if both of the following are satisfied:

  • ac
  • bd
Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇


Determine the minimum number of moves required to go from (sx,sy) to (ex,ey).

Input Format

  • The first line contains a single integer T — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains four integer sxsyexey — the coordinates of

  •  the starting and ending cells.

Output Format

For each testcase, output the minimum number of moves required to go from (sx,sy) to (ex,ey).

Constraints

  • 1T1000
  • 1sx,sy,ex,ey10

No comments:

Post a Comment