I want to find the neighboring element that surrounds p.
I know we can use brute-force approach, like this: array[i-1][i]
array[i-1][i-1]
array[i][i-1]<