e...,sorry about my english,my solution used 1-2ms(i see it in "Accepted Solutions Runtime Distribution"),

```
public int next(int[][] grid,int x,int y) {
if (x == grid.length - 1 && y == grid[0].length - 1) return grid[x][y];
if(grid[x][y]<0) return -grid[x][y];
int down = x < grid.length - 1 ? next(grid, x + 1, y) : Integer.MAX_VALUE;
int right = y < grid[0].length - 1 ? next(grid, x, y + 1) : Integer.MAX_VALUE;
int result = Math.min(down, right) + grid[x][y];
grid[x][y] = -result;
return result;
}
public int minPathSum(int[][] grid) {
return next(grid,0,0);
}
```