Reduce the space cost to O(N) of the solution of Minimum Path Sum.