@@ -0,0 +1,911 @@
+/***%0A * Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.%0A *%0A * Note: You can only move either down or right at any point in time.%0A */%0Apublic class Solution %7B%0A    // Solution 1: DP %0A    // f%5Bx%5D%5By%5D = min(f%5Bx - 1%5D%5By%5D, f%5Bx%5D%5By - 1%5D) + gird%5Bx%5D%5By%5D, store path%0A    public int minPathSum(int%5B%5D%5B%5D grid) %7B%0A        int m = grid.length;%0A        if (m == 0) return 0;%0A        int n = grid%5B0%5D.length;%0A        int f%5B%5D%5B%5D = new int%5Bm%5D%5Bn%5D;%0A        f%5B0%5D%5B0%5D = grid%5B0%5D%5B0%5D;%0A        for (int i = 1; i %3C m; i++)%0A            f%5Bi%5D%5B0%5D = f%5Bi - 1%5D%5B0%5D + grid%5Bi%5D%5B0%5D;%0A        for (int j = 1; j %3C n; j++)%0A            f%5B0%5D%5Bj%5D = f%5B0%5D%5Bj - 1%5D + grid%5B0%5D%5Bj%5D;%0A        for (int i = 1; i %3C m; i++)%0A            for (int j = 1; j %3C n; j++)%0A                f%5Bi%5D%5Bj%5D = Math.min(f%5Bi - 1%5D%5Bj%5D, f%5Bi%5D%5Bj - 1%5D) + grid%5Bi%5D%5Bj%5D;%0A        return f%5Bm - 1%5D%5Bn - 1%5D;%0A    %7D%0A%7D%0A

add MinimumPathSum.java