Minimum path sum in matrix

question link :- LeetCode
solution link:mkZ8Pa - Online C++0x Compiler & Debugging Tool - Ideone.com

why this code giving the wrong answer can please help me

because you are visiting same i,j multiple times and it doesn’t work in n*n. Try memoisizing the recursion and it will get AC.

Do you understand the difference between title and description? Please make the necessary edits.

2 Likes