***************unique path2


error

Hey @nmaurya760
Error is on line 30 it should be dp[i][j]=-1
If u still face the issue let me know

Error is coming now also

Ok so
add j>0 here if(obstacleGrid[i][j-1] != 1){
and i>0 here if(obstacleGrid[i-1][j] != 1){

This removes syntatical errors ,now try to debug logically

i am not getting what you are trying to say…

Instead of

if(obstacleGrid[i][j-1] != 1){
if(obstacleGrid[i-1][j] != 1){

use

if(j>0&&obstacleGrid[i][j-1] != 1){
if(i>0&&obstacleGrid[i-1][j] != 1){

I have tried this…still runtime error is coming


Not on my side ,please check again :slight_smile:

But the answer is wrong :sweat_smile:

Hey @nmaurya760
Yes I know that’s why I said try to debug logically yourself.

And I can see many logical errors so it will be better if u see and understand the solution from here if u can’t debug on ur own :https://leetcode.com/problems/unique-paths-ii/solution/

Hey @nmaurya760
If this is resolved then please mark it so:)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.