Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6b958be

Browse files
refactor 1219
1 parent8e49849 commit6b958be

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

‎src/main/java/com/fishercoder/solutions/_1219.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,6 @@
33
importjava.util.LinkedList;
44
importjava.util.Queue;
55

6-
/**
7-
* 1219. Path with Maximum Gold
8-
*
9-
* In a gold mine grid of size m * n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty.
10-
* Return the maximum amount of gold you can collect under the conditions:
11-
* Every time you are located in a cell you will collect all the gold in that cell.
12-
* From your position you can walk one step to the left, right, up or down.
13-
* You can't visit the same cell more than once.
14-
* Never visit a cell with 0 gold.
15-
* You can start and stop collecting gold from any position in the grid that has some gold.
16-
*
17-
* Example 1:
18-
* Input: grid = [[0,6,0],[5,8,7],[0,9,0]]
19-
* Output: 24
20-
* Explanation:
21-
* [[0,6,0],
22-
* [5,8,7],
23-
* [0,9,0]]
24-
* Path to get the maximum gold, 9 -> 8 -> 7.
25-
*
26-
* Example 2:
27-
* Input: grid = [[1,0,7],[2,0,6],[3,4,5],[0,3,0],[9,0,20]]
28-
* Output: 28
29-
* Explanation:
30-
* [[1,0,7],
31-
* [2,0,6],
32-
* [3,4,5],
33-
* [0,3,0],
34-
* [9,0,20]]
35-
* Path to get the maximum gold, 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7.
36-
*
37-
* Constraints:
38-
* 1 <= grid.length, grid[i].length <= 15
39-
* 0 <= grid[i][j] <= 100
40-
* There are at most 25 cells containing gold.
41-
* */
426
publicclass_1219 {
437
publicstaticclassSolution1 {
448
publicintgetMaximumGold(int[][]grid) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp