algorithms icon indicating copy to clipboard operation
algorithms copied to clipboard

Fails for 50% of use cases

Open mrishab opened this issue 6 years ago • 1 comments

Try the following input lot

lot = [
    [1,0,9,1],
    [1,0,1,1],
    [1,0,1,1],
    [1,0,1,1],
    [1,0,1,1],
    [1,0,1,1],
    [1,1,1,1],
]

Correct Answer: 15 Algorithm's Ouptut: 2

mrishab avatar May 06 '19 22:05 mrishab

Thanks Rishab for reporting this issue. Yes, you are right this is not the correct approach, we have to take care of the assumption that robot can only go on flat areas(that is on 1s) not on trenches(represented by 0). I think, using DP with memoization will solve this problem.

Unfortunately, i will have to have remove this code snippet as i got a notice from DMCA.

Sorry for responding so late.

Thanks!

hansrajdas avatar May 20 '19 19:05 hansrajdas