I was solving this problem: CodeChef: Practical coding for everyone
It looked like a simple DP and I implemented it here: CodeChef: Practical coding for everyone
However, it gives me a Segmentation Fault.
I tried to debug it and found that the problem is with this line:
int curr_value = grid[i][j] + grid[j][N - i - 1];
When I set it to 0, it gives me WA as expected.
Surprisingly, when I switched to Recursion + Memoization, it gives me an AC.
This is the solution using Recursion: CodeChef: Practical coding for everyone
Can someone tell me why the first solution isn’t working?