Robot Delivery Path Problem
You are tasked with directing a robot from the top-left corner of an N*N matrix to a specified point (x, y), delivering a parcel. The robot is restricted to move only on flat areas (denoted by 1), and can't move on obstacles (denoted by 0). The target position is marked with a 5. Determine if it is possible for the robot to reach the destination by moving downwards or rightwards without leaving the matrix boundaries.
Input:
Integer T, the number of test cases.
For each test case -
Integer N, defining the matrix size.
Integers x and y, the destination coordinates.
N lines each containing N space-separated integers (0, 1, or 5) representing the matrix.
Output:
For each test case, return true if the robot can reach the position (x, y). Otherwise, return false.
Example:
Input:
1
3 2 2
1 0 1
1 1 1
1 1 5
Output:
true
Explanation:
The robot starts at (0,0) and moves to (2,2) following the path (0,0) -> (1,0) -> (2,0) -> (2,1) -> (2,2).
Constraints:
1 <= T <= 10
1 <= N <= 100
matrix[i][j]
values are 0, 1, or 5
Note that the robot starts at position (0,0)
which is always marked as 1.

Determine if a robot can reach a specified destination in a matrix by moving only downwards or rightwards.
Start at (0,0) and move towards the destination (x, y) only downwards or rightwards.
Check if t...read more
Amazon Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Amazon Software Developer


Reviews
Interviews
Salaries
Users

