min path in a matrix

dynamic programing. two method, O(mn)space and O(n) space, depending on
how we use dp. and one failed method, just leave it alone.