1219:黄金矿工
This commit is contained in:
parent
0952e98843
commit
3dad0a822d
@ -68,11 +68,13 @@ class PathWithMaximumGold {
|
|||||||
boolean[][] use = new boolean[grid.length][grid[0].length];
|
boolean[][] use = new boolean[grid.length][grid[0].length];
|
||||||
for (int i = 0; i < grid.length; i++) {
|
for (int i = 0; i < grid.length; i++) {
|
||||||
for (int j = 0; j < grid[0].length; j++) {
|
for (int j = 0; j < grid[0].length; j++) {
|
||||||
|
if (grid[i][j] != 0) {
|
||||||
use[i][j] = true;
|
use[i][j] = true;
|
||||||
counts = Math.max(counts, dfs(i, j, grid, use));
|
counts = Math.max(counts, dfs(i, j, grid, use));
|
||||||
use[i][j] = false;
|
use[i][j] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return counts;
|
return counts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user