-
Notifications
You must be signed in to change notification settings - Fork 130
A: new #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
A: new #789
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
problems/apples-oranges/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!--|This file generated by command(leetcode description); DO NOT EDIT. |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
<!--|@author openset <openset.wang@gmail.com> |--> | ||
<!--|@link https://github.com/openset |--> | ||
<!--|@home https://github.com/openset/leetcode |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
|
||
[< Previous](../number-of-ways-of-cutting-a-pizza "Number of Ways of Cutting a Pizza") | ||
|
||
[Next >](../consecutive-characters "Consecutive Characters") | ||
|
||
## [1445. Apples & Oranges (Medium)](https://leetcode.com/problems/apples-oranges "") | ||
|
||
|
10 changes: 10 additions & 0 deletions
problems/apples-oranges/mysql_schemas.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Create table If Not Exists Sales (sale_date date, fruit ENUM('apples', 'oranges'), sold_num int); | ||
Truncate table Sales; | ||
insert into Sales (sale_date, fruit, sold_num) values ('2020年05月01日', 'apples', '10'); | ||
insert into Sales (sale_date, fruit, sold_num) values ('2020年05月01日', 'oranges', '8'); | ||
insert into Sales (sale_date, fruit, sold_num) values ('2020年05月02日', 'apples', '15'); | ||
insert into Sales (sale_date, fruit, sold_num) values ('2020年05月02日', 'oranges', '15'); | ||
insert into Sales (sale_date, fruit, sold_num) values ('2020年05月03日', 'apples', '20'); | ||
insert into Sales (sale_date, fruit, sold_num) values ('2020年05月03日', 'oranges', '0'); | ||
insert into Sales (sale_date, fruit, sold_num) values ('2020年05月04日', 'apples', '15'); | ||
insert into Sales (sale_date, fruit, sold_num) values ('2020年05月04日', 'oranges', '16'); |
76 changes: 76 additions & 0 deletions
problems/consecutive-characters/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<!--|This file generated by command(leetcode description); DO NOT EDIT. |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
<!--|@author openset <openset.wang@gmail.com> |--> | ||
<!--|@link https://github.com/openset |--> | ||
<!--|@home https://github.com/openset/leetcode |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
|
||
[< Previous](../apples-oranges "Apples & Oranges") | ||
|
||
[Next >](../simplified-fractions "Simplified Fractions") | ||
|
||
## [1446. Consecutive Characters (Easy)](https://leetcode.com/problems/consecutive-characters "连续字符") | ||
|
||
<p>Given a string <code>s</code>, the power of the string is the maximum length of a non-empty substring that contains only one unique character.</p> | ||
|
||
<p>Return <em>the power</em> of the string.</p> | ||
|
||
<p> </p> | ||
<p><strong>Example 1:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> s = "leetcode" | ||
<strong>Output:</strong> 2 | ||
<strong>Explanation:</strong> The substring "ee" is of length 2 with the character 'e' only. | ||
</pre> | ||
|
||
<p><strong>Example 2:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> s = "abbcccddddeeeeedcba" | ||
<strong>Output:</strong> 5 | ||
<strong>Explanation:</strong> The substring "eeeee" is of length 5 with the character 'e' only. | ||
</pre> | ||
|
||
<p><strong>Example 3:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> s = "triplepillooooow" | ||
<strong>Output:</strong> 5 | ||
</pre> | ||
|
||
<p><strong>Example 4:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> s = "hooraaaaaaaaaaay" | ||
<strong>Output:</strong> 11 | ||
</pre> | ||
|
||
<p><strong>Example 5:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> s = "tourist" | ||
<strong>Output:</strong> 1 | ||
</pre> | ||
|
||
<p> </p> | ||
<p><strong>Constraints:</strong></p> | ||
|
||
<ul> | ||
<li><code>1 <= s.length <= 500</code></li> | ||
<li><code>s</code> contains only lowercase English letters.</li> | ||
</ul> | ||
|
||
### Related Topics | ||
[[String](../../tag/string/README.md)] | ||
|
||
### Hints | ||
<details> | ||
<summary>Hint 1</summary> | ||
Keep an array power where power[i] is the maximum power of the i-th character. | ||
</details> | ||
|
||
<details> | ||
<summary>Hint 2</summary> | ||
The answer is max(power[i]). | ||
</details> |
64 changes: 64 additions & 0 deletions
problems/count-good-nodes-in-binary-tree/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!--|This file generated by command(leetcode description); DO NOT EDIT. |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
<!--|@author openset <openset.wang@gmail.com> |--> | ||
<!--|@link https://github.com/openset |--> | ||
<!--|@home https://github.com/openset/leetcode |--> | ||
<!--+----------------------------------------------------------------------+--> | ||
|
||
[< Previous](../simplified-fractions "Simplified Fractions") | ||
|
||
[Next >](../form-largest-integer-with-digits-that-add-up-to-target "Form Largest Integer With Digits That Add up to Target") | ||
|
||
## [1448. Count Good Nodes in Binary Tree (Medium)](https://leetcode.com/problems/count-good-nodes-in-binary-tree "统计二叉树中好节点的数目") | ||
|
||
<p>Given a binary tree <code>root</code>, a node <em>X</em> in the tree is named <strong>good</strong> if in the path from root to <em>X</em> there are no nodes with a value <em>greater than</em> X.</p> | ||
|
||
<p>Return the number of <strong>good</strong> nodes in the binary tree.</p> | ||
|
||
<p> </p> | ||
<p><strong>Example 1:</strong></p> | ||
|
||
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2020/04/02/test_sample_1.png" style="width: 263px; height: 156px;" /></strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> root = [3,1,4,3,null,1,5] | ||
<strong>Output:</strong> 4 | ||
<strong>Explanation:</strong> Nodes in blue are <strong>good</strong>. | ||
Root Node (3) is always a good node. | ||
Node 4 -> (3,4) is the maximum value in the path starting from the root. | ||
Node 5 -> (3,4,5) is the maximum value in the path | ||
Node 3 -> (3,1,3) is the maximum value in the path.</pre> | ||
|
||
<p><strong>Example 2:</strong></p> | ||
|
||
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2020/04/02/test_sample_2.png" style="width: 157px; height: 161px;" /></strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> root = [3,3,null,4,2] | ||
<strong>Output:</strong> 3 | ||
<strong>Explanation:</strong> Node 2 -> (3, 3, 2) is not good, because "3" is higher than it.</pre> | ||
|
||
<p><strong>Example 3:</strong></p> | ||
|
||
<pre> | ||
<strong>Input:</strong> root = [1] | ||
<strong>Output:</strong> 1 | ||
<strong>Explanation:</strong> Root is considered as <strong>good</strong>.</pre> | ||
|
||
<p> </p> | ||
<p><strong>Constraints:</strong></p> | ||
|
||
<ul> | ||
<li>The number of nodes in the binary tree is in the range <code>[1, 10^5]</code>.</li> | ||
<li>Each node's value is between <code>[-10^4, 10^4]</code>.</li> | ||
</ul> | ||
|
||
### Related Topics | ||
[[Tree](../../tag/tree/README.md)] | ||
[[Depth-first Search](../../tag/depth-first-search/README.md)] | ||
|
||
### Hints | ||
<details> | ||
<summary>Hint 1</summary> | ||
Use DFS (Depth First Search) to traverse the tree, and constantly keep track of the current path maximum. | ||
</details> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.