hey can anyone share their approach for this problem !!
question link : Programming Problems and Competitions :: HackerRank
@ vijju123
hey can anyone share their approach for this problem !!
question link : Programming Problems and Competitions :: HackerRank
@ vijju123
My approach was to make a DP of [3][3][n][m]… which will represent (direction it will go, direction from where it is coming, x, y).
Now there can be 3 major cases:
Solution now will be to call DP in first row for all cases. O(33nm) = maximum (0.3610^8)
This solution is correct. I don’t know why i got abort called on 2 of the cases but otherwise it’s one of the correct approaches.
great work mate !! can u plzz share your code
Programming Problems and Competitions :: HackerRank … Is it visible to you? Now it works for all the test cases too… I changed DP to [3][3][2][m], this works as we only need next for calculation of current row. Earlier due to size of [3][3][n][m] it was giving abort.
yeah i am able to see your code
thnks man!!