Dunzo SDE1 coding question
Anonymous User
663
Feb 25, 2022

Given a matrix of size MxN consisting of { L, R, U, B }.
The value ‘L’ represents you can go left from that cell. similarly ‘R’ right, ‘U’ up, and ‘B’ bottom.

You are at the top leftmost cell (1, 1). You can change any cell value to ‘L’, ‘R’, ‘U’, ‘B’. You have to find minimum changes in the matrix so that there exists a path from (1,1) to (m,n) cell.

Ex- [ [R , B , L],
[L , B , R],
[R , R , U]]
Ans = 0
As there already exist a path ,
(1,1)->(1,2)->(2,2)->(3,2)->(3,3).

Can anyone tell the approach and code in python3?

thanks,

Comments (5)