Skip to content

Commit b3b1374

Browse files
committed
feat: add solutions to lc problems: No.2614~2617
* No.2614.Prime In Diagonal * No.2615.Sum of Distances * No.2616.Minimize the Maximum Difference of Pairs * No.2617.Minimum Number of Visited Cells in a Grid
1 parent a383a04 commit b3b1374

File tree

49 files changed

+2210
-590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2210
-590
lines changed

solution/0100-0199/0124.Binary Tree Maximum Path Sum/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p><strong>路径</strong> 被定义为一条从树中任意节点出发,沿父节点-子节点连接,达到任意节点的序列。同一个节点在一条路径序列中 <strong>至多出现一次</strong> 。该路径<strong> 至少包含一个 </strong>节点,且不一定经过根节点。</p>
9+
<p>二叉树中的<strong> 路径</strong> 被定义为一条节点序列,序列中每对相邻节点之间都存在一条边。同一个节点在一条路径序列中 <strong>至多出现一次</strong> 。该路径<strong> 至少包含一个 </strong>节点,且不一定经过根节点。</p>
1010

1111
<p><strong>路径和</strong> 是路径中各节点值的总和。</p>
1212

1313
<p>给你一个二叉树的根节点 <code>root</code> ,返回其 <strong>最大路径和</strong> 。</p>
1414

15-
<p> </p>
15+
<p>&nbsp;</p>
1616

1717
<p><strong>示例 1:</strong></p>
1818
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0100-0199/0124.Binary%20Tree%20Maximum%20Path%20Sum/images/exx1.jpg" style="width: 322px; height: 182px;" />
1919
<pre>
2020
<strong>输入:</strong>root = [1,2,3]
2121
<strong>输出:</strong>6
22-
<strong>解释:</strong>最优路径是 2 -> 1 -> 3 ,路径和为 2 + 1 + 3 = 6</pre>
22+
<strong>解释:</strong>最优路径是 2 -&gt; 1 -&gt; 3 ,路径和为 2 + 1 + 3 = 6</pre>
2323

2424
<p><strong>示例 2:</strong></p>
2525
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0100-0199/0124.Binary%20Tree%20Maximum%20Path%20Sum/images/exx2.jpg" />
2626
<pre>
2727
<strong>输入:</strong>root = [-10,9,20,null,null,15,7]
2828
<strong>输出:</strong>42
29-
<strong>解释:</strong>最优路径是 15 -> 20 -> 7 ,路径和为 15 + 20 + 7 = 42
29+
<strong>解释:</strong>最优路径是 15 -&gt; 20 -&gt; 7 ,路径和为 15 + 20 + 7 = 42
3030
</pre>
3131

32-
<p> </p>
32+
<p>&nbsp;</p>
3333

3434
<p><strong>提示:</strong></p>
3535

3636
<ul>
3737
<li>树中节点数目范围是 <code>[1, 3 * 10<sup>4</sup>]</code></li>
38-
<li><code>-1000 <= Node.val <= 1000</code></li>
38+
<li><code>-1000 &lt;= Node.val &lt;= 1000</code></li>
3939
</ul>
4040

4141
## 解法

solution/0100-0199/0163.Missing Ranges/README_EN.md

+8-13
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,25 @@
44

55
## Description
66

7-
<p>You are given an inclusive range <code>[lower, upper]</code> and a <strong>sorted unique</strong> integer array <code>nums</code>, where all elements are in the inclusive range.</p>
7+
<p>You are given an inclusive range <code>[lower, upper]</code> and a <strong>sorted unique</strong> integer array <code>nums</code>, where all elements are within the inclusive range.</p>
88

99
<p>A number <code>x</code> is considered <strong>missing</strong> if <code>x</code> is in the range <code>[lower, upper]</code> and <code>x</code> is not in <code>nums</code>.</p>
1010

11-
<p>Return <em>the <strong>smallest sorted</strong> list of ranges that <strong>cover every missing number exactly</strong></em>. That is, no element of <code>nums</code> is in any of the ranges, and each missing number is in one of the ranges.</p>
11+
<p>Return <em>the <strong>shortest sorted</strong> list of ranges that <b>exactly covers all the missing numbers</b></em>. That is, no element of <code>nums</code> is included in any of the ranges, and each missing number is covered by one of the ranges.</p>
1212

13-
<p>Each range <code>[a,b]</code> in the list should be output as:</p>
14-
15-
<ul>
16-
<li><code>&quot;a-&gt;b&quot;</code> if <code>a != b</code></li>
17-
<li><code>&quot;a&quot;</code> if <code>a == b</code></li>
18-
</ul>
13+
<p>&nbsp;</p>
1914

2015
<p>&nbsp;</p>
2116
<p><strong class="example">Example 1:</strong></p>
2217

2318
<pre>
2419
<strong>Input:</strong> nums = [0,1,3,50,75], lower = 0, upper = 99
25-
<strong>Output:</strong> [&quot;2&quot;,&quot;4-&gt;49&quot;,&quot;51-&gt;74&quot;,&quot;76-&gt;99&quot;]
20+
<strong>Output:</strong> [[2,2],[4,49],[51,74],[76,99]]
2621
<strong>Explanation:</strong> The ranges are:
27-
[2,2] --&gt; &quot;2&quot;
28-
[4,49] --&gt; &quot;4-&gt;49&quot;
29-
[51,74] --&gt; &quot;51-&gt;74&quot;
30-
[76,99] --&gt; &quot;76-&gt;99&quot;
22+
[2,2]
23+
[4,49]
24+
[51,74]
25+
[76,99]
3126
</pre>
3227

3328
<p><strong class="example">Example 2:</strong></p>

solution/0300-0399/0320.Generalized Abbreviation/README_EN.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
<ul>
1010
<li>For example, <code>&quot;abcde&quot;</code> can be abbreviated into:
11-
1211
<ul>
1312
<li><code>&quot;a3e&quot;</code> (<code>&quot;bcd&quot;</code> turned into <code>&quot;3&quot;</code>)</li>
1413
<li><code>&quot;1bcd1&quot;</code> (<code>&quot;a&quot;</code> and <code>&quot;e&quot;</code> both turned into <code>&quot;1&quot;</code>)</li>
@@ -22,7 +21,6 @@
2221
<li><code>&quot;22de&quot;</code> (<code>&quot;ab&quot;</code> turned into <code>&quot;2&quot;</code> and <code>&quot;bc&quot;</code> turned into <code>&quot;2&quot;</code>) is invalid as the substring chosen overlap.</li>
2322
</ul>
2423
</li>
25-
2624
</ul>
2725

2826
<p>Given a string <code>word</code>, return <em>a list of all the possible <strong>generalized abbreviations</strong> of</em> <code>word</code>. Return the answer in <strong>any order</strong>.</p>

0 commit comments

Comments
 (0)