Exit Point of a matrix

easy
Interesting set of interview questions on matrix.</br>
&emsp;1. You are given a 2d matrix containing 1's and 0's.</br>
&emsp;2. The player enters the matrix at 0, 0 in east direction.</br>
&emsp;3. The player moves straight till the time 0's are encountered. On meeting a 1, the player turns 90 degree right.</br>
&emsp;4. You should print the coordinates of the point where player exits the matrix.</br>

Input Format

Input is handled for you. This is a functional problem

Output Format

row, col of the last spot visited in matrix as comma separated variables </br> &emsp; e.g. 1, 2

Constraints

The matrix is upto 10^4 * 10^4 in size.

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.
Previous
Fib Till N
Next
Placing N Queen in a matrix

Related Questions