Unique paths in a grid with obstacles!

Правка en1, от code_warrior, 2020-06-29 09:30:22

Recently ,I faced a question which says that given a square matrix of size n x n with entries only as 0 ans 1's ,we are required to count the number of unique paths from (1,1) to (n,n) if "0" means that the cell is safe and "1" means that there is an obstacle. We are allowed to move in four directions if possible that is from (X,Y), one can move to (X,Y+1), (X,Y-1),(X+1,Y) or (X-1,Y). Each cell can be visited at most once. I tried to solve it with dyanamic programming , but couldn't make my way to AC.

Can anyone give me some hint how to solve this?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский code_warrior 2020-06-29 09:36:46 22 Tiny change: 'y to AC.\n\nCan anyo' -> 'y to AC.\nOne thing more, N<=20.\nCan anyo'
en1 Английский code_warrior 2020-06-29 09:30:22 598 Initial revision (published)