Skip to content

Commit 827613c

Browse files
committed
Create README - LeetHub
1 parent e070cb6 commit 827613c

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

1219-path-with-maximum-gold/README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<h2><a href="https://leetcode.com/problems/path-with-maximum-gold">1219. Path with Maximum Gold</a></h2><h3>Medium</h3><hr><p>In a gold mine <code>grid</code> of size <code>m x n</code>, each cell in this mine has an integer representing the amount of gold in that cell, <code>0</code> if it is empty.</p>
2+
3+
<p>Return the maximum amount of gold you can collect under the conditions:</p>
4+
5+
<ul>
6+
<li>Every time you are located in a cell you will collect all the gold in that cell.</li>
7+
<li>From your position, you can walk one step to the left, right, up, or down.</li>
8+
<li>You can&#39;t visit the same cell more than once.</li>
9+
<li>Never visit a cell with <code>0</code> gold.</li>
10+
<li>You can start and stop collecting gold from <strong>any </strong>position in the grid that has some gold.</li>
11+
</ul>
12+
13+
<p>&nbsp;</p>
14+
<p><strong class="example">Example 1:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> grid = [[0,6,0],[5,8,7],[0,9,0]]
18+
<strong>Output:</strong> 24
19+
<strong>Explanation:</strong>
20+
[[0,6,0],
21+
[5,8,7],
22+
[0,9,0]]
23+
Path to get the maximum gold, 9 -&gt; 8 -&gt; 7.
24+
</pre>
25+
26+
<p><strong class="example">Example 2:</strong></p>
27+
28+
<pre>
29+
<strong>Input:</strong> grid = [[1,0,7],[2,0,6],[3,4,5],[0,3,0],[9,0,20]]
30+
<strong>Output:</strong> 28
31+
<strong>Explanation:</strong>
32+
[[1,0,7],
33+
[2,0,6],
34+
[3,4,5],
35+
[0,3,0],
36+
[9,0,20]]
37+
Path to get the maximum gold, 1 -&gt; 2 -&gt; 3 -&gt; 4 -&gt; 5 -&gt; 6 -&gt; 7.
38+
</pre>
39+
40+
<p>&nbsp;</p>
41+
<p><strong>Constraints:</strong></p>
42+
43+
<ul>
44+
<li><code>m == grid.length</code></li>
45+
<li><code>n == grid[i].length</code></li>
46+
<li><code>1 &lt;= m, n &lt;= 15</code></li>
47+
<li><code>0 &lt;= grid[i][j] &lt;= 100</code></li>
48+
<li>There are at most <strong>25 </strong>cells containing gold.</li>
49+
</ul>

0 commit comments

Comments
 (0)