Pls help me find the error (CHFDORA)

Heres my solution for CHFDORA Jan long challenge. Pls find the error.

Bumping this. Pls help guys

For some elements (like the element at last row and last column) the checking of palindrome condition will access the matrix out of bound.
Consider a 3*3 matrix.
For your element at a[2][2], w=2 so your checking condition will check if a[2+2][2]==a[2-2][2] (if a[4][2]==a[0][2]) but a[4][2] doesn’t exist, so it should give a Runtime error.
Just add a condition before checking palindromes which checks the matrix doesn’t go out of bounds)

Ohh wait! It isn’t giving Runtime error because your matrix is huge. a[4][2] actually exists in your matrix with some garbage value.

Yeah and that garbage value is 0 so shudnt the program terminate there itself?

Why will it terminate? It will compare a[4][2] with a[0][2] and if they are equal, it will add to the answer, which shouldn’t be the case