I used this method to get AC, but I wonder whether this method can solve the problem as following:

01 01 01 01

99 99 99 01

99 01 01 01

99 01 99 99

99 01 01 01

Since we only consider min(sum[i - 1][j], sum[i][j - 1]), we cannot turn left in this test case. Can this work?

Minimum Path Sum