@@ -0,0 +1,1072 @@
+/**%0A *%09Given a m x n grid filled with non-negative numbers, %0A *%09find a path from top left to bottom right which minimizes the sum %0A *%09of all numbers along its path.%0A *%0A *%09Note: You can only move either down or right at any point in time.%09%0A *%0A *%09Author: matao%0A *%0A */%0A%0Apublic class MinimumPathSum %7B%0A%09public int minPathSum(int%5B%5D%5B%5D grid) %7B%0A        if(grid == null %7C%7C grid.length == 0 %7C%7C grid%5B0%5D.length == 0) %7B%0A            return 0;%0A        %7D%0A        int rows = grid.length, columns = grid%5B0%5D.length;%0A%0A        int%5B%5D%5B%5D result = new int%5Brows%5D%5Bcolumns%5D;%0A        result%5B0%5D%5B0%5D = grid%5B0%5D%5B0%5D;%0A%0A        for(int i = 1; i %3C rows; i++) %7B%0A            result%5Bi%5D%5B0%5D = result%5Bi-1%5D%5B0%5D + grid%5Bi%5D%5B0%5D;%0A        %7D%0A%0A        for(int i = 1; i %3C columns; i++) %7B%0A            result%5B0%5D%5Bi%5D = result%5B0%5D%5Bi-1%5D + grid%5B0%5D%5Bi%5D;%0A        %7D%0A%0A        for(int i = 1; i %3C rows; i++) %7B%0A            for(int j = 1; j %3C columns; j++) %7B%0A                result%5Bi%5D%5Bj%5D = (result%5Bi%5D%5Bj-1%5D %3C result%5Bi-1%5D%5Bj%5D ? result%5Bi%5D%5Bj-1%5D : result%5Bi-1%5D%5Bj%5D) + grid%5Bi%5D%5Bj%5D;%0A            %7D%0A        %7D%0A        return result%5Brows-1%5D%5Bcolumns-1%5D;%0A    %7D%0A%7D

add Minimum Path Sum solution