Skip to content

Commit e6da31b

Browse files
author
Shuo
authored
Merge pull request #563 from openset/develop
Update: description
2 parents 6fd5468 + 7d52dd4 commit e6da31b

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

problems/last-stone-weight/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,34 @@
2222

2323
<p>At the end, there is at most 1 stone left.&nbsp; Return the weight of this stone (or 0 if there are no stones left.)</p>
2424

25+
<p>&nbsp;</p>
26+
27+
<p><strong>Example 1:</strong></p>
28+
29+
<pre>
30+
<strong>Input: </strong>[2,7,4,1,8,1]
31+
<strong>Output: </strong>1
32+
<strong>Explanation: </strong>
33+
We combine 7 and 8 to get 1 so the array converts to [2,4,1,1,1] then,
34+
we combine 2 and 4 to get 2 so the array converts to [2,1,1,1] then,
35+
we combine 2 and 1 to get 1 so the array converts to [1,1,1] then,
36+
we combine 1 and 1 to get 0 so the array converts to [1] then that&#39;s the value of last stone.</pre>
37+
38+
<p>&nbsp;</p>
39+
2540
<p><strong>Note:</strong></p>
2641

2742
<ol>
2843
<li><code>1 &lt;= stones.length &lt;= 30</code></li>
2944
<li><code>1 &lt;= stones[i] &lt;= 1000</code></li>
3045
</ol>
46+
47+
### Related Topics
48+
[[Heap](https://github.com/openset/leetcode/tree/master/tag/heap/README.md)]
49+
[[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]
50+
51+
### Hints
52+
<details>
53+
<summary>Hint 1</summary>
54+
Simulate the process. We can do it with a heap, or by sorting some list of stones every time we take a turn.
55+
</details>

problems/longest-string-chain/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,17 @@
4242
<div>
4343
<p>&nbsp;</p>
4444
</div>
45+
46+
### Related Topics
47+
[[Hash Table](https://github.com/openset/leetcode/tree/master/tag/hash-table/README.md)]
48+
[[Dynamic Programming](https://github.com/openset/leetcode/tree/master/tag/dynamic-programming/README.md)]
49+
50+
### Hints
51+
<details>
52+
<summary>Hint 1</summary>
53+
Instead of adding a character, try deleting a character to form a chain in reverse.
54+
</details>
55+
<details>
56+
<summary>Hint 2</summary>
57+
For each word in order of length, for each word2 which is word with one character removed, length[word2] = max(length[word2], length[word] + 1).
58+
</details>

problems/remove-all-adjacent-duplicates-in-string/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ For example, in &quot;abbaca&quot; we could remove &quot;bb&quot; since the lett
3636
<li><code>1 &lt;= S.length &lt;= 20000</code></li>
3737
<li><code>S</code> consists only of English lowercase letters.</li>
3838
</ol>
39+
40+
### Related Topics
41+
[[Stack](https://github.com/openset/leetcode/tree/master/tag/stack/README.md)]
42+
43+
### Hints
44+
<details>
45+
<summary>Hint 1</summary>
46+
Use a stack to process everything greedily.
47+
</details>

0 commit comments

Comments
 (0)