Skip to content

Add: new #730

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
merged 1 commit into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ LeetCode Problems' Solutions

| # | Title | Solution | Difficulty |
| :-: | - | - | :-: |
| <span id="1279">1279</span> | [Traffic Light Controlled Intersection](https://leetcode.com/problems/traffic-light-controlled-intersection) 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/traffic-light-controlled-intersection) | Easy |
| <span id="1278">1278</span> | [Palindrome Partitioning III](https://leetcode.com/problems/palindrome-partitioning-iii "分割回文串 III") | [Go](https://github.com/openset/leetcode/tree/master/problems/palindrome-partitioning-iii) | Hard |
| <span id="1277">1277</span> | [Count Square Submatrices with All Ones](https://leetcode.com/problems/count-square-submatrices-with-all-ones "统计全为 1 的正方形子矩阵") | [Go](https://github.com/openset/leetcode/tree/master/problems/count-square-submatrices-with-all-ones) | Medium |
| <span id="1276">1276</span> | [Number of Burgers with No Waste of Ingredients](https://leetcode.com/problems/number-of-burgers-with-no-waste-of-ingredients "不浪费原料的汉堡制作方案") | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-burgers-with-no-waste-of-ingredients) | Medium |
| <span id="1275">1275</span> | [Find Winner on a Tic Tac Toe Game](https://leetcode.com/problems/find-winner-on-a-tic-tac-toe-game "找出井字棋的获胜者") | [Go](https://github.com/openset/leetcode/tree/master/problems/find-winner-on-a-tic-tac-toe-game) | Easy |
| <span id="1274">1274</span> | [Number of Ships in a Rectangle](https://leetcode.com/problems/number-of-ships-in-a-rectangle "矩形内船只的数目") | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-ships-in-a-rectangle) | Hard |
| <span id="1273">1273</span> | [Delete Tree Nodes](https://leetcode.com/problems/delete-tree-nodes "删除树节点") | [Go](https://github.com/openset/leetcode/tree/master/problems/delete-tree-nodes) | Medium |
| <span id="1272">1272</span> | [Remove Interval](https://leetcode.com/problems/remove-interval "删除区间") | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-interval) | Medium |
| <span id="1271">1271</span> | [Hexspeak](https://leetcode.com/problems/hexspeak "十六进制魔术数字") | [Go](https://github.com/openset/leetcode/tree/master/problems/hexspeak) | Easy |
| <span id="1274">1274</span> | [Number of Ships in a Rectangle](https://leetcode.com/problems/number-of-ships-in-a-rectangle "矩形内船只的数目") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-ships-in-a-rectangle) | Hard |
| <span id="1273">1273</span> | [Delete Tree Nodes](https://leetcode.com/problems/delete-tree-nodes "删除树节点") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/delete-tree-nodes) | Medium |
| <span id="1272">1272</span> | [Remove Interval](https://leetcode.com/problems/remove-interval "删除区间") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/remove-interval) | Medium |
| <span id="1271">1271</span> | [Hexspeak](https://leetcode.com/problems/hexspeak "十六进制魔术数字") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/hexspeak) | Easy |
| <span id="1270">1270</span> | [All People Report to the Given Manager](https://leetcode.com/problems/all-people-report-to-the-given-manager) 🔒 | [MySQL](https://github.com/openset/leetcode/tree/master/problems/all-people-report-to-the-given-manager) | Medium |
| <span id="1269">1269</span> | [Number of Ways to Stay in the Same Place After Some Steps](https://leetcode.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps "停在原地的方案数") | [Go](https://github.com/openset/leetcode/tree/master/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps) | Hard |
| <span id="1268">1268</span> | [Search Suggestions System](https://leetcode.com/problems/search-suggestions-system "搜索推荐系统") | [Go](https://github.com/openset/leetcode/tree/master/problems/search-suggestions-system) | Medium |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<p>Storekeeper is a&nbsp;game&nbsp;in which the player pushes boxes around in a warehouse&nbsp;trying to get them to target locations.</p>

<p>The game is represented by a <code>grid</code> of size&nbsp;<code>n<font face="sans-serif, Arial, Verdana, Trebuchet MS">*</font></code><code>m</code>, where each element is a wall, floor, or a box.</p>
<p>The game is represented by a <code>grid</code> of size&nbsp;<code>m x n</code>, where each element is a wall, floor, or a box.</p>

<p>Your task is move the box <code>&#39;B&#39;</code> to the target position <code>&#39;T&#39;</code> under the following rules:</p>

Expand Down Expand Up @@ -81,8 +81,10 @@
<p><strong>Constraints:</strong></p>

<ul>
<li><code>1 &lt;= grid.length &lt;= 20</code></li>
<li><code>1 &lt;= grid[i].length &lt;= 20</code></li>
<li><code>m ==&nbsp;grid.length</code></li>
<li><code>n ==&nbsp;grid[i].length</code></li>
<li><code>1 &lt;= m &lt;= 20</code></li>
<li><code>1 &lt;= n &lt;= 20</code></li>
<li><code>grid</code> contains only characters&nbsp;<code>&#39;.&#39;</code>, <code>&#39;#&#39;</code>,&nbsp; <code>&#39;S&#39;</code> , <code>&#39;T&#39;</code>,&nbsp;or <code>&#39;B&#39;</code>.</li>
<li>There is only one character&nbsp;<code>&#39;S&#39;</code>, <code>&#39;B&#39;</code>&nbsp;<font face="sans-serif, Arial, Verdana, Trebuchet MS">and&nbsp;</font><code>&#39;T&#39;</code>&nbsp;in the <code>grid</code>.</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion problems/palindrome-partitioning-iii/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[< Previous](https://github.com/openset/leetcode/tree/master/problems/count-square-submatrices-with-all-ones "Count Square Submatrices with All Ones")

Next >
[Next >](https://github.com/openset/leetcode/tree/master/problems/traffic-light-controlled-intersection "Traffic Light Controlled Intersection")

## [1278. Palindrome Partitioning III (Hard)](https://leetcode.com/problems/palindrome-partitioning-iii "分割回文串 III")

Expand Down
25 changes: 15 additions & 10 deletions problems/populating-next-right-pointers-in-each-node-ii/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,30 @@ struct Node {

<p>&nbsp;</p>

<p><strong>Example:</strong></p>
<p><strong>Follow up:</strong></p>

<p><img alt="" src="https://assets.leetcode.com/uploads/2019/02/15/117_sample.png" style="width: 640px; height: 218px;" /></p>
<ul>
<li>You may only use constant extra space.</li>
<li>Recursive approach is fine, you may assume implicit stack space does not count as extra space for this problem.</li>
</ul>

<pre>
<strong>Input: </strong><span>{&quot;$id&quot;:&quot;1&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;2&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;3&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:4},&quot;next&quot;:null,&quot;right&quot;:{&quot;$id&quot;:&quot;4&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:5},&quot;val&quot;:2},&quot;next&quot;:null,&quot;right&quot;:{&quot;$id&quot;:&quot;5&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:{&quot;$id&quot;:&quot;6&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:7},&quot;val&quot;:3},&quot;val&quot;:1}</span>
<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>

<strong>Output: </strong><span>{&quot;$id&quot;:&quot;1&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;2&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;3&quot;,&quot;left&quot;:null,&quot;next&quot;:{&quot;$id&quot;:&quot;4&quot;,&quot;left&quot;:null,&quot;next&quot;:{&quot;$id&quot;:&quot;5&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:7},&quot;right&quot;:null,&quot;val&quot;:5},&quot;right&quot;:null,&quot;val&quot;:4},&quot;next&quot;:{&quot;$id&quot;:&quot;6&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:{&quot;$ref&quot;:&quot;5&quot;},&quot;val&quot;:3},&quot;right&quot;:{&quot;$ref&quot;:&quot;4&quot;},&quot;val&quot;:2},&quot;next&quot;:null,&quot;right&quot;:{&quot;$ref&quot;:&quot;6&quot;},&quot;val&quot;:1}</span>
<p><img alt="" src="https://assets.leetcode.com/uploads/2019/02/15/117_sample.png" style="width: 640px; height: 218px;" /></p>

<strong>Explanation: </strong>Given the above binary tree (Figure A), your function should populate each next pointer to point to its next right node, just like in Figure B.
<pre>
<strong>Input:</strong> root = [1,2,3,4,5,null,7]
<strong>Output:</strong> [1,#,2,3,#,4,5,7,#]
<strong>Explanation: </strong>Given the above binary tree (Figure A), your function should populate each next pointer to point to its next right node, just like in Figure B. The serialized output is in level order as connected by the next pointers, with &#39;#&#39; signifying the end of each level.
</pre>

<p>&nbsp;</p>

<p><strong>Note:</strong></p>
<p><strong>Constraints:</strong></p>

<ul>
<li>You may only use constant extra space.</li>
<li>Recursive approach is fine, implicit stack space does not count as extra space for this problem.</li>
<li>The number of nodes in the given tree is less than <code>6000</code>.</li>
<li><code>-100&nbsp;&lt;= node.val &lt;= 100</code></li>
</ul>

### Related Topics
Expand Down
25 changes: 15 additions & 10 deletions problems/populating-next-right-pointers-in-each-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,30 @@ struct Node {

<p>&nbsp;</p>

<p><strong>Example:</strong></p>
<p><strong>Follow up:</strong></p>

<p><img alt="" src="https://assets.leetcode.com/uploads/2019/02/14/116_sample.png" style="width: 640px; height: 218px;" /></p>
<ul>
<li>You may only use constant extra space.</li>
<li>Recursive approach is fine, you may assume implicit stack space does not count as extra space for this problem.</li>
</ul>

<pre>
<strong>Input: </strong><span>{&quot;$id&quot;:&quot;1&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;2&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;3&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:4},&quot;next&quot;:null,&quot;right&quot;:{&quot;$id&quot;:&quot;4&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:5},&quot;val&quot;:2},&quot;next&quot;:null,&quot;right&quot;:{&quot;$id&quot;:&quot;5&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;6&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:6},&quot;next&quot;:null,&quot;right&quot;:{&quot;$id&quot;:&quot;7&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:7},&quot;val&quot;:3},&quot;val&quot;:1}</span>
<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>

<strong>Output: </strong><span>{&quot;$id&quot;:&quot;1&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;2&quot;,&quot;left&quot;:{&quot;$id&quot;:&quot;3&quot;,&quot;left&quot;:null,&quot;next&quot;:{&quot;$id&quot;:&quot;4&quot;,&quot;left&quot;:null,&quot;next&quot;:{&quot;$id&quot;:&quot;5&quot;,&quot;left&quot;:null,&quot;next&quot;:{&quot;$id&quot;:&quot;6&quot;,&quot;left&quot;:null,&quot;next&quot;:null,&quot;right&quot;:null,&quot;val&quot;:7},&quot;right&quot;:null,&quot;val&quot;:6},&quot;right&quot;:null,&quot;val&quot;:5},&quot;right&quot;:null,&quot;val&quot;:4},&quot;next&quot;:{&quot;$id&quot;:&quot;7&quot;,&quot;left&quot;:{&quot;$ref&quot;:&quot;5&quot;},&quot;next&quot;:null,&quot;right&quot;:{&quot;$ref&quot;:&quot;6&quot;},&quot;val&quot;:3},&quot;right&quot;:{&quot;$ref&quot;:&quot;4&quot;},&quot;val&quot;:2},&quot;next&quot;:null,&quot;right&quot;:{&quot;$ref&quot;:&quot;7&quot;},&quot;val&quot;:1}</span>
<p><img alt="" src="https://assets.leetcode.com/uploads/2019/02/14/116_sample.png" style="width: 640px; height: 218px;" /></p>

<strong>Explanation: </strong>Given the above perfect binary tree (Figure A), your function should populate each next pointer to point to its next right node, just like in Figure B.
<pre>
<strong>Input:</strong> root = [1,2,3,4,5,6,7]
<strong>Output:</strong> [1,#,2,3,#,4,5,6,7,#]
<strong>Explanation: </strong>Given the above perfect binary tree (Figure A), your function should populate each next pointer to point to its next right node, just like in Figure B. The serialized output is in level order as connected by the next pointers, with &#39;#&#39; signifying the end of each level.
</pre>

<p>&nbsp;</p>

<p><strong>Note:</strong></p>
<p><strong>Constraints:</strong></p>

<ul>
<li>You may only use constant extra space.</li>
<li>Recursive approach is fine, implicit stack space does not count as extra space for this problem.</li>
<li>The number of nodes in the given tree is less than <code>4096</code>.</li>
<li><code>-1000 &lt;= node.val &lt;= 1000</code></li>
</ul>

### Related Topics
Expand Down
2 changes: 1 addition & 1 deletion problems/reach-a-number/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

[Next >](https://github.com/openset/leetcode/tree/master/problems/pour-water "Pour Water")

## [754. Reach a Number (Easy)](https://leetcode.com/problems/reach-a-number "到达终点数字")
## [754. Reach a Number (Medium)](https://leetcode.com/problems/reach-a-number "到达终点数字")

<p>
You are standing at position <code>0</code> on an infinite number line. There is a goal at position <code>target</code>.
Expand Down
1 change: 1 addition & 0 deletions problems/search-suggestions-system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ After typing mou, mous and mouse the system suggests [&quot;mouse&quot;,&quot;mo

<ul>
<li><code>1 &lt;= products.length &lt;= 1000</code></li>
<li>There are no&nbsp;repeated elements in&nbsp;<code>products</code>.</li>
<li><code>1 &lt;= &Sigma; products[i].length &lt;= 2 * 10^4</code></li>
<li>All characters of <code>products[i]</code> are lower-case English letters.</li>
<li><code>1 &lt;= searchWord.length &lt;= 1000</code></li>
Expand Down
12 changes: 7 additions & 5 deletions problems/shift-2d-grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

## [1260. Shift 2D Grid (Easy)](https://leetcode.com/problems/shift-2d-grid "二维网格迁移")

<p>Given a 2D <code>grid</code> of size <code>n</code> * <code>m</code>&nbsp;and an integer <code>k</code>. You need to shift the <code>grid</code>&nbsp;<code>k</code> times.</p>
<p>Given a 2D <code>grid</code> of size <code>m x n</code>&nbsp;and an integer <code>k</code>. You need to shift the <code>grid</code>&nbsp;<code>k</code> times.</p>

<p>In one shift operation:</p>

<ul>
<li>Element at <code>grid[i][j]</code> becomes at <code>grid[i][j + 1]</code>.</li>
<li>Element at <code>grid[i][m - 1]</code> becomes at <code>grid[i + 1][0]</code>.</li>
<li>Element at <code>grid[n - 1][m - 1]</code> becomes at <code>grid[0][0]</code>.</li>
<li>Element at <code>grid[i][n - 1]</code> becomes at <code>grid[i + 1][0]</code>.</li>
<li>Element at <code>grid[n - 1][n - 1]</code> becomes at <code>grid[0][0]</code>.</li>
</ul>

<p>Return the <em>2D grid</em> after applying shift operation <code>k</code> times.</p>
Expand Down Expand Up @@ -49,8 +49,10 @@
<p><strong>Constraints:</strong></p>

<ul>
<li><code>1 &lt;= grid.length &lt;= 50</code></li>
<li><code>1 &lt;= grid[i].length &lt;= 50</code></li>
<li><code>m ==&nbsp;grid.length</code></li>
<li><code>n ==&nbsp;grid[i].length</code></li>
<li><code>1 &lt;= m &lt;= 50</code></li>
<li><code>1 &lt;= n &lt;= 50</code></li>
<li><code>-1000 &lt;= grid[i][j] &lt;= 1000</code></li>
<li><code>0 &lt;= k &lt;= 100</code></li>
</ul>
Expand Down
22 changes: 11 additions & 11 deletions problems/similar-string-groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@

<p>We are given a list <code>A</code> of strings.&nbsp; Every string in <code>A</code> is an anagram of every other string in <code>A</code>.&nbsp; How many groups are there?</p>

<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>

<pre>
<strong>Input: </strong>[&quot;tars&quot;,&quot;rats&quot;,&quot;arts&quot;,&quot;star&quot;]
<strong>Output: </strong>2</pre>

<p><strong>Note:</strong></p>

<ol>
<li><code>A.length &lt;= 2000</code></li>
<li><code>A[i].length &lt;= 1000</code></li>
<pre><strong>Input:</strong> A = ["tars","rats","arts","star"]
<strong>Output:</strong> 2
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
<li><code>1 &lt;= A.length &lt;= 2000</code></li>
<li><code>1 &lt;= A[i].length &lt;= 1000</code></li>
<li><code>A.length * A[i].length &lt;= 20000</code></li>
<li>All words in <code>A</code>&nbsp;consist of lowercase letters only.</li>
<li>All words in <code>A</code> have the same length and are anagrams of each other.</li>
<li>The judging time limit has been increased for this question.</li>
</ol>
</ul>

### Related Topics
[[Depth-first Search](https://github.com/openset/leetcode/tree/master/tag/depth-first-search/README.md)]
Expand Down
14 changes: 14 additions & 0 deletions problems/traffic-light-controlled-intersection/README.md
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](https://github.com/openset/leetcode/tree/master/problems/palindrome-partitioning-iii "Palindrome Partitioning III")

Next >

## [1279. Traffic Light Controlled Intersection (Easy)](https://leetcode.com/problems/traffic-light-controlled-intersection "")


2 changes: 1 addition & 1 deletion readme/601-900.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ LeetCode Problems' Solutions
| <span id="751">751</span> | [IP to CIDR](https://leetcode.com/problems/ip-to-cidr "IP 到 CIDR") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/ip-to-cidr) | Easy |
| <span id="752">752</span> | [Open the Lock](https://leetcode.com/problems/open-the-lock "打开转盘锁") | [Go](https://github.com/openset/leetcode/tree/master/problems/open-the-lock) | Medium |
| <span id="753">753</span> | [Cracking the Safe](https://leetcode.com/problems/cracking-the-safe "破解保险箱") | [Go](https://github.com/openset/leetcode/tree/master/problems/cracking-the-safe) | Hard |
| <span id="754">754</span> | [Reach a Number](https://leetcode.com/problems/reach-a-number "到达终点数字") | [Go](https://github.com/openset/leetcode/tree/master/problems/reach-a-number) | Easy |
| <span id="754">754</span> | [Reach a Number](https://leetcode.com/problems/reach-a-number "到达终点数字") | [Go](https://github.com/openset/leetcode/tree/master/problems/reach-a-number) | Medium |
| <span id="755">755</span> | [Pour Water](https://leetcode.com/problems/pour-water "倒水") 🔒 | [Go](https://github.com/openset/leetcode/tree/master/problems/pour-water) | Medium |
| <span id="756">756</span> | [Pyramid Transition Matrix](https://leetcode.com/problems/pyramid-transition-matrix "金字塔转换矩阵") | [Go](https://github.com/openset/leetcode/tree/master/problems/pyramid-transition-matrix) | Medium |
| <span id="757">757</span> | [Set Intersection Size At Least Two](https://leetcode.com/problems/set-intersection-size-at-least-two " 设置交集大小至少为2") | [Go](https://github.com/openset/leetcode/tree/master/problems/set-intersection-size-at-least-two) | Hard |
Expand Down
Loading