Skip to content

Commit 46419ab

Browse files
authored
feat: update lc problems (doocs#3175)
1 parent 59680d1 commit 46419ab

File tree

8 files changed

+34
-49
lines changed
  • solution
    • 0400-0499/0489.Robot Room Cleaner
    • 1000-1099/1095.Find in Mountain Array
    • 1200-1299/1236.Web Crawler
    • 1400-1499/1428.Leftmost Column with at Least a One
    • 1500-1599
      • 1533.Find the Index of the Large Integer
      • 1538.Guess the Majority in a Hidden Array
    • 1900-1999/1953.Maximum Number of Weeks for Which You Can Work
    • 2700-2799/2753.Count Houses in a Circular Street II

8 files changed

+34
-49
lines changed

solution/0400-0499/0489.Robot Room Cleaner/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tags:
2121

2222
<p>机器人从一个未知的空单元格开始出发,并且你无法访问网格,但你可以使用给定的 API <code>Robot</code> 控制机器人。</p>
2323

24-
<p>你的任务是使用机器人清扫整个房间(即清理房间中的每个空单元格)。机器人具有四个给定的API,可以前进、向左转或向右转。每次转弯 90 度。</p>
24+
<p>你的任务是使用机器人清扫整个房间(即清理房间中的每个空单元格)。机器人具有四个给定的API,可以前进、向左转或向右转。每次转弯 <code>90</code> 度。</p>
2525

2626
<p>当机器人试图移动到一个存在障碍物的单元格时,它的碰撞传感器会检测到障碍物,并停留在当前单元格。</p>
2727

solution/1000-1099/1095.Find in Mountain Array/README.md

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,28 @@ tags:
2222

2323
<p>(这是一个 <strong>交互式问题&nbsp;</strong>)</p>
2424

25-
<p>给你一个 <strong>山脉数组</strong>&nbsp;<code>mountainArr</code>,请你返回能够使得&nbsp;<code>mountainArr.get(index)</code>&nbsp;<strong>等于</strong>&nbsp;<code>target</code>&nbsp;<strong>最小</strong>&nbsp;的下标 <code>index</code>&nbsp;值。</p>
26-
27-
<p>如果不存在这样的下标 <code>index</code>,就请返回&nbsp;<code>-1</code>。</p>
28-
29-
<p>&nbsp;</p>
30-
31-
<p>何为山脉数组?如果数组&nbsp;<code>A</code> 是一个山脉数组的话,那它满足如下条件:</p>
32-
33-
<p><strong>首先</strong>,<code>A.length &gt;= 3</code></p>
34-
35-
<p><strong>其次</strong>,在&nbsp;<code>0 &lt; i&nbsp;&lt; A.length - 1</code>&nbsp;条件下,存在 <code>i</code> 使得:</p>
25+
<p>你可以将一个数组&nbsp;<code>arr</code>&nbsp;称为&nbsp;<strong>山脉数组&nbsp;</strong>当且仅当:</p>
3626

3727
<ul>
38-
<li><code>A[0] &lt; A[1] &lt; ... A[i-1] &lt; A[i]</code></li>
39-
<li><code>A[i] &gt; A[i+1] &gt; ... &gt; A[A.length - 1]</code></li>
28+
<li><code>arr.length &gt;= 3</code></li>
29+
<li>存在一些&nbsp;<code>0 &lt; i &lt; arr.length - 1</code>&nbsp;的&nbsp;<code>i</code>&nbsp;使得:
30+
<ul>
31+
<li><code>arr[0] &lt; arr[1] &lt; ... &lt; arr[i - 1] &lt; arr[i]</code></li>
32+
<li><code>arr[i] &gt; arr[i + 1] &gt; ... &gt; arr[arr.length - 1]</code></li>
33+
</ul>
34+
</li>
4035
</ul>
4136

42-
<p>&nbsp;</p>
37+
<p>给定一个山脉数组&nbsp;<code>mountainArr</code>&nbsp;,返回&nbsp;<strong>最小</strong> 的&nbsp;<code>index</code>&nbsp;使得&nbsp;<code>mountainArr.get(index) == target</code>。如果不存在这样的&nbsp;<code>index</code>,返回&nbsp;<code>-1</code>&nbsp;</p>
4338

44-
<p>你将&nbsp;<strong>不能直接访问该山脉数组</strong>,必须通过&nbsp;<code>MountainArray</code>&nbsp;接口来获取数据:</p>
39+
<p><strong>你无法直接访问山脉数组</strong>。你只能使用&nbsp;<code>MountainArray</code>&nbsp;接口来访问数组:</p>
4540

4641
<ul>
47-
<li><code>MountainArray.get(k)</code>&nbsp;- 会返回数组中索引为<code>k</code>&nbsp;的元素(下标从 0 开始)</li>
48-
<li><code>MountainArray.length()</code>&nbsp;- 会返回该数组的长度</li>
42+
<li><code>MountainArray.get(k)</code>&nbsp;返回数组中下标为&nbsp;<code>k</code>&nbsp;的元素( 0 开始)</li>
43+
<li><code>MountainArray.length()</code>&nbsp;返回数组的长度。</li>
4944
</ul>
5045

51-
<p>&nbsp;</p>
52-
53-
<p><strong>注意:</strong></p>
54-
55-
<p>对&nbsp;<code>MountainArray.get</code>&nbsp;发起超过 <code>100</code> 次调用的提交将被视为错误答案。此外,任何试图规避判题系统的解决方案都将会导致比赛资格被取消。</p>
56-
57-
<p>为了帮助大家更好地理解交互式问题,我们准备了一个样例 &ldquo;<strong>答案</strong>&rdquo;:<a href="https://leetcode.cn/playground/RKhe3ave" target="_blank">https://leetcode.cn/playground/RKhe3ave</a>,请注意这 <strong>不是一个正确答案</strong>。</p>
46+
<p>调用&nbsp;<code>MountainArray.get</code>&nbsp;超过&nbsp;<code>100</code>&nbsp;次的提交会被判定为错误答案。此外,任何试图绕过在线评测的解决方案都将导致取消资格。</p>
5847

5948
<ol>
6049
</ol>
@@ -63,13 +52,15 @@ tags:
6352

6453
<p><strong>示例 1:</strong></p>
6554

66-
<pre><strong>输入:</strong>array = [1,2,3,4,5,3,1], target = 3
55+
<pre>
56+
<strong>输入:</strong>array = [1,2,3,4,5,3,1], target = 3
6757
<strong>输出:</strong>2
6858
<strong>解释:</strong>3 在数组中出现了两次,下标分别为 2 和 5,我们返回最小的下标 2。</pre>
6959

7060
<p><strong>示例 2:</strong></p>
7161

72-
<pre><strong>输入:</strong>array = [0,1,2,4,2,1], target = 3
62+
<pre>
63+
<strong>输入:</strong>array = [0,1,2,4,2,1], target = 3
7364
<strong>输出:</strong>-1
7465
<strong>解释:</strong>3 在数组中没有出现,返回 -1。
7566
</pre>
@@ -79,9 +70,9 @@ tags:
7970
<p><strong>提示:</strong></p>
8071

8172
<ul>
82-
<li><code>3 &lt;= mountain_arr.length() &lt;= 10000</code></li>
83-
<li><code>0 &lt;= target &lt;= 10^9</code></li>
84-
<li><code>0 &lt;= mountain_arr.get(index) &lt;=&nbsp;10^9</code></li>
73+
<li><code>3 &lt;= mountain_arr.length() &lt;= 10<sup>4</sup></code></li>
74+
<li><code>0 &lt;= target &lt;= 10<sup>9</sup></code></li>
75+
<li><code>0 &lt;= mountain_arr.get(index) &lt;=&nbsp;10<sup>9</sup></code></li>
8576
</ul>
8677

8778
<!-- description:end -->

solution/1200-1299/1236.Web Crawler/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ tags:
1919

2020
<!-- description:start -->
2121

22-
<p>给定一个链接&nbsp;<code>startUrl</code> 和一个接口&nbsp;<code>HtmlParser</code>&nbsp;,请你实现一个网络爬虫,以实现爬取同&nbsp;<code>startUrl</code>&nbsp;拥有相同&nbsp;<strong>域名标签&nbsp;</strong>的全部链接。该爬虫得到的全部链接可以&nbsp;<strong>任何顺序&nbsp;</strong>返回结果。</p>
22+
<p>给定一个链接&nbsp;<code>startUrl</code> 和一个接口&nbsp;<code>HtmlParser</code>&nbsp;,请你实现一个网络爬虫,以实现爬取同&nbsp;<code>startUrl</code>&nbsp;拥有相同&nbsp;<strong>域名标签&nbsp;</strong>的全部链接。</p>
23+
24+
<p>该爬虫得到的全部链接可以&nbsp;<strong>任何顺序&nbsp;</strong>返回结果。</p>
2325

2426
<p>你的网络爬虫应当按照如下模式工作:</p>
2527

@@ -32,7 +34,7 @@ tags:
3234

3335
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1200-1299/1236.Web%20Crawler/images/urlhostname.png" style="height: 164px; width: 600px;" /></p>
3436

35-
<p>如上所示的一个链接,其域名为&nbsp;<code>example.org</code>。简单起见,你可以假设所有的链接都采用&nbsp;<strong>http协议&nbsp;</strong>并没有指定&nbsp;<strong>端口</strong>。例如,链接&nbsp;<code>http://leetcode.com/problems</code>&nbsp;&nbsp;<code>http://leetcode.com/contest</code>&nbsp;是同一个域名下的,而链接<code>http://example.org/test</code>&nbsp;&nbsp;<code>http://example.com/abc</code> 是不在同一域名下的。</p>
37+
<p>如上所示的一个链接,其域名为&nbsp;<code>example.org</code>。简单起见,你可以假设所有的链接都采用&nbsp;<strong>http协议&nbsp;</strong>并没有指定&nbsp;<strong>端口</strong>。例如,链接&nbsp;<code>http://leetcode.com/problems</code>&nbsp;&nbsp;<code>http://leetcode.com/contest</code>&nbsp;是同一个域名下的,而链接&nbsp;<code>http://example.org/test</code>&nbsp;&nbsp;<code>http://example.com/abc</code> 是不在同一域名下的。</p>
3638

3739
<p><code>HtmlParser</code> 接口定义如下:&nbsp;</p>
3840

@@ -44,6 +46,8 @@ interface HtmlParser {
4446

4547
<p>下面是两个实例,用以解释该问题的设计功能,对于自定义测试,你可以使用三个变量&nbsp;&nbsp;<code>urls</code>,&nbsp;<code>edges</code>&nbsp;&nbsp;<code>startUrl</code>。注意在代码实现中,你只可以访问&nbsp;<code>startUrl</code>&nbsp;,而&nbsp;<code>urls</code>&nbsp;&nbsp;<code>edges</code>&nbsp;不可以在你的代码中被直接访问。</p>
4648

49+
<p>注意:将尾随斜线“/”的相同 URL 视为不同的 URL。例如,“http://news.yahoo.com” 和 “http://news.yahoo.com/” 是不同的域名。</p>
50+
4751
<p>&nbsp;</p>
4852

4953
<p><strong>示例 1:</strong></p>

solution/1400-1499/1428.Leftmost Column with at Least a One/README.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ tags:
1919

2020
<!-- description:start -->
2121

22-
<p><em>(这是一个<strong>交互题</strong>)</em></p>
22+
<p><strong>行排序二进制矩阵</strong>&nbsp;表示所有元素都是 <code>0</code> 或 <code>1</code>,并且矩阵的每一行都以非递减排序。</p>
2323

24-
<p>我们称只包含元素&nbsp;<code>0</code>&nbsp;&nbsp;<code>1</code>&nbsp;的矩阵为二进制矩阵。矩阵中每个<strong>单独</strong>的行都按非递减顺序排序。</p>
25-
26-
<p>给定一个这样的二进制矩阵,返回至少包含一个&nbsp;<code>1</code>&nbsp;的最左端列的索引(从 0 开始)。如果这样的列不存在,返回&nbsp;<code>-1</code>。</p>
24+
<p>给定一个 <strong>行排序二进制矩阵&nbsp;</strong><code>binaryMatrix</code>,返回至少包含一个&nbsp;<code>1</code>&nbsp;的 <strong>最左端列&nbsp;</strong>的索引(从 0 开始)。如果这样的列不存在,返回&nbsp;<code>-1</code>。</p>
2725

2826
<p><strong>您不能直接访问该二进制矩阵。</strong>你只可以通过&nbsp;<code>BinaryMatrix</code>&nbsp;接口来访问。</p>
2927

@@ -62,15 +60,7 @@ tags:
6260

6361
<pre>
6462
<strong>输入:</strong> mat = [[0,0],[0,0]]
65-
<strong>输出:</strong> -1</pre>
66-
67-
<p><strong>示例 4:</strong></p>
68-
69-
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1400-1499/1428.Leftmost%20Column%20with%20at%20Least%20a%20One/images/untitled-diagram-6.jpg" style="height:121px; width:161px" /></strong></p>
70-
71-
<pre>
72-
<strong>输入:</strong> mat = [[0,0,0,1],[0,0,1,1],[0,1,1,1]]
73-
<strong>输出:</strong> 1
63+
<strong>输出:</strong> -1
7464
</pre>
7565

7666
<p>&nbsp;</p>

solution/1500-1599/1533.Find the Index of the Large Integer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ reader.compareSub(4, 4, 5, 5) // 返回 1。因此,可以确定 arr[4] 是数
6767
<p><strong>提示:</strong></p>
6868

6969
<ul>
70-
<li><code>2 &lt;= arr.length&nbsp;&lt;= 5 * 10^5</code></li>
70+
<li><code>2 &lt;= arr.length&nbsp;&lt;= 5 * 10<sup>5</sup></code></li>
7171
<li><code>1 &lt;= arr[i] &lt;= 100</code></li>
7272
<li><code>arr</code>&nbsp;中除一个最大元素外,其余所有元素都相等。</li>
7373
</ul>

solution/1500-1599/1538.Guess the Majority in a Hidden Array/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ reader.query(4,5,6,7) // 返回 4,因为 nums[4], nums[5], nums[6], nums[7]
7272
<p><strong>提示:</strong></p>
7373

7474
<ul>
75-
<li><code>5 &lt;= nums.length&nbsp;&lt;= 10^5</code></li>
75+
<li><code>5 &lt;= nums.length&nbsp;&lt;= 10<sup>5</sup></code></li>
7676
<li><code>0 &lt;= nums[i] &lt;= 1</code></li>
7777
</ul>
7878

solution/1900-1999/1953.Maximum Number of Weeks for Which You Can Work/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tags:
2828
<li>在 <strong>连续的</strong> 两周中,你 <strong>不能</strong> 参与并完成同一个项目中的两个阶段任务。</li>
2929
</ul>
3030

31-
<p>一旦所有项目中的全部阶段任务都完成,那么你将停止工作;如果选择任意剩余任务都会导致违反上述规则,那么你也会&nbsp;<strong>停止工作</strong>。注意,由于这些条件的限制,你可能无法完成所有阶段任务。</p>
31+
<p>一旦所有项目中的全部阶段任务都完成,或者执行仅剩的一个阶段任务将会导致你违反上面的规则,你将 <strong>停止工作</strong>。注意,由于这些条件的限制,你可能无法完成所有阶段任务。</p>
3232

3333
<p>返回在不违反上面规则的情况下你&nbsp;<strong>最多</strong>&nbsp;能工作多少周。</p>
3434

solution/2700-2799/2753.Count Houses in a Circular Street II/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/2700-2799/2753.Co
1414

1515
<!-- description:start -->
1616

17-
<p>给定一个代表&nbsp;<strong>环形&nbsp;</strong>街道的类&nbsp;<code>Street</code>&nbsp;和一个正整数&nbsp;<code>k</code>,表示街道上房屋的最大数量(也就是说房屋数量不超过&nbsp;<code>k</code>)。每个房屋的门初始时可以是开着的也可以是关着的(至少有一个房屋的门是开着的)。</p>
17+
<p>给定一个代表&nbsp;<strong>环形&nbsp;</strong>街道的类&nbsp;<code>Street</code>&nbsp;的对象&nbsp;<code>street</code> 和一个正整数&nbsp;<code>k</code>,表示街道上房屋的最大数量(也就是说房屋数量不超过&nbsp;<code>k</code>)。每个房屋的门初始时可以是开着的也可以是关着的(至少有一个房屋的门是开着的)。</p>
1818

1919
<p>刚开始,你站在一座房子的门前。你的任务是计算街道上的房屋数量。</p>
2020

0 commit comments

Comments
 (0)