Knight in a War Grid
Accessibility in a grid consisting of cells with heights and water flooding.
A graph model
Consider the graph consisting of grid cells containing no water and there is an edge between two cells if the difference in coordinates is respectively N and M.
The goal is to compute the connected component containing the cell (0,0). In this component count the number of odd and the number of even degree vertices. A simple DFS exploration can solve the problem.