Back to the Problem
Every cell (i, j) with i, j ≥ 1 must equal its upper-left neighbour.
Complexity: O(NM)