Skip to content

Commit 7646741

Browse files
committed
更新国外版新增题目
1 parent bc30d9a commit 7646741

19 files changed

+6353
-4497
lines changed

leetcode/origin-data.json

Lines changed: 4842 additions & 4497 deletions
Large diffs are not rendered by default.

leetcode/originData/count-lattice-points-inside-a-circle.json

Lines changed: 186 additions & 0 deletions
Large diffs are not rendered by default.

leetcode/originData/count-number-of-rectangles-containing-each-point.json

Lines changed: 181 additions & 0 deletions
Large diffs are not rendered by default.

leetcode/originData/count-prefixes-of-a-given-string.json

Lines changed: 154 additions & 0 deletions
Large diffs are not rendered by default.

leetcode/originData/number-of-flowers-in-full-bloom.json

Lines changed: 194 additions & 0 deletions
Large diffs are not rendered by default.

leetcode/originData/remove-digit-from-number-to-maximize-result.json

Lines changed: 156 additions & 0 deletions
Large diffs are not rendered by default.

leetcode/originData/total-appeal-of-a-string.json

Lines changed: 157 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<p>Given a 2D integer array <code>circles</code> where <code>circles[i] = [x<sub>i</sub>, y<sub>i</sub>, r<sub>i</sub>]</code> represents the center <code>(x<sub>i</sub>, y<sub>i</sub>)</code> and radius <code>r<sub>i</sub></code> of the <code>i<sup>th</sup></code> circle drawn on a grid, return <em>the <strong>number of lattice points</strong> </em><em>that are present inside <strong>at least one</strong> circle</em>.</p>
2+
3+
<p><strong>Note:</strong></p>
4+
5+
<ul>
6+
<li>A <strong>lattice point</strong> is a point with integer coordinates.</li>
7+
<li>Points that lie <strong>on the circumference of a circle</strong> are also considered to be inside it.</li>
8+
</ul>
9+
10+
<p>&nbsp;</p>
11+
<p><strong>Example 1:</strong></p>
12+
<img alt="" src="https://assets.leetcode.com/uploads/2022/03/02/exa-11.png" style="width: 300px; height: 300px;" />
13+
<pre>
14+
<strong>Input:</strong> circles = [[2,2,1]]
15+
<strong>Output:</strong> 5
16+
<strong>Explanation:</strong>
17+
The figure above shows the given circle.
18+
The lattice points present inside the circle are (1, 2), (2, 1), (2, 2), (2, 3), and (3, 2) and are shown in green.
19+
Other points such as (1, 1) and (1, 3), which are shown in red, are not considered inside the circle.
20+
Hence, the number of lattice points present inside at least one circle is 5.</pre>
21+
22+
<p><strong>Example 2:</strong></p>
23+
<img alt="" src="https://assets.leetcode.com/uploads/2022/03/02/exa-22.png" style="width: 300px; height: 300px;" />
24+
<pre>
25+
<strong>Input:</strong> circles = [[2,2,2],[3,4,1]]
26+
<strong>Output:</strong> 16
27+
<strong>Explanation:</strong>
28+
The figure above shows the given circles.
29+
There are exactly 16 lattice points which are present inside at least one circle.
30+
Some of them are (0, 2), (2, 0), (2, 4), (3, 2), and (4, 4).
31+
</pre>
32+
33+
<p>&nbsp;</p>
34+
<p><strong>Constraints:</strong></p>
35+
36+
<ul>
37+
<li><code>1 &lt;= circles.length &lt;= 200</code></li>
38+
<li><code>circles[i].length == 3</code></li>
39+
<li><code>1 &lt;= x<sub>i</sub>, y<sub>i</sub> &lt;= 100</code></li>
40+
<li><code>1 &lt;= r<sub>i</sub> &lt;= min(x<sub>i</sub>, y<sub>i</sub>)</code></li>
41+
</ul>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<p>You are given a 2D integer array <code>rectangles</code> where <code>rectangles[i] = [l<sub>i</sub>, h<sub>i</sub>]</code> indicates that <code>i<sup>th</sup></code> rectangle has a length of <code>l<sub>i</sub></code> and a height of <code>h<sub>i</sub></code>. You are also given a 2D integer array <code>points</code> where <code>points[j] = [x<sub>j</sub>, y<sub>j</sub>]</code> is a point with coordinates <code>(x<sub>j</sub>, y<sub>j</sub>)</code>.</p>
2+
3+
<p>The <code>i<sup>th</sup></code> rectangle has its <strong>bottom-left corner</strong> point at the coordinates <code>(0, 0)</code> and its <strong>top-right corner</strong> point at <code>(l<sub>i</sub>, h<sub>i</sub>)</code>.</p>
4+
5+
<p>Return<em> an integer array </em><code>count</code><em> of length </em><code>points.length</code><em> where </em><code>count[j]</code><em> is the number of rectangles that <strong>contain</strong> the </em><code>j<sup>th</sup></code><em> point.</em></p>
6+
7+
<p>The <code>i<sup>th</sup></code> rectangle <strong>contains</strong> the <code>j<sup>th</sup></code> point if <code>0 &lt;= x<sub>j</sub> &lt;= l<sub>i</sub></code> and <code>0 &lt;= y<sub>j</sub> &lt;= h<sub>i</sub></code>. Note that points that lie on the <strong>edges</strong> of a rectangle are also considered to be contained by that rectangle.</p>
8+
9+
<p>&nbsp;</p>
10+
<p><strong>Example 1:</strong></p>
11+
<img alt="" src="https://assets.leetcode.com/uploads/2022/03/02/example1.png" style="width: 300px; height: 509px;" />
12+
<pre>
13+
<strong>Input:</strong> rectangles = [[1,2],[2,3],[2,5]], points = [[2,1],[1,4]]
14+
<strong>Output:</strong> [2,1]
15+
<strong>Explanation:</strong>
16+
The first rectangle contains no points.
17+
The second rectangle contains only the point (2, 1).
18+
The third rectangle contains the points (2, 1) and (1, 4).
19+
The number of rectangles that contain the point (2, 1) is 2.
20+
The number of rectangles that contain the point (1, 4) is 1.
21+
Therefore, we return [2, 1].
22+
</pre>
23+
24+
<p><strong>Example 2:</strong></p>
25+
<img alt="" src="https://assets.leetcode.com/uploads/2022/03/02/example2.png" style="width: 300px; height: 312px;" />
26+
<pre>
27+
<strong>Input:</strong> rectangles = [[1,1],[2,2],[3,3]], points = [[1,3],[1,1]]
28+
<strong>Output:</strong> [1,3]
29+
<strong>Explanation:
30+
</strong>The first rectangle contains only the point (1, 1).
31+
The second rectangle contains only the point (1, 1).
32+
The third rectangle contains the points (1, 3) and (1, 1).
33+
The number of rectangles that contain the point (1, 3) is 1.
34+
The number of rectangles that contain the point (1, 1) is 3.
35+
Therefore, we return [1, 3].
36+
</pre>
37+
38+
<p>&nbsp;</p>
39+
<p><strong>Constraints:</strong></p>
40+
41+
<ul>
42+
<li><code>1 &lt;= rectangles.length, points.length &lt;= 5 * 10<sup>4</sup></code></li>
43+
<li><code>rectangles[i].length == points[j].length == 2</code></li>
44+
<li><code>1 &lt;= l<sub>i</sub>, x<sub>j</sub> &lt;= 10<sup>9</sup></code></li>
45+
<li><code>1 &lt;= h<sub>i</sub>, y<sub>j</sub> &lt;= 100</code></li>
46+
<li>All the <code>rectangles</code> are <strong>unique</strong>.</li>
47+
<li>All the <code>points</code> are <strong>unique</strong>.</li>
48+
</ul>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<p>You are given a string array <code>words</code> and a string <code>s</code>, where <code>words[i]</code> and <code>s</code> comprise only of <strong>lowercase English letters</strong>.</p>
2+
3+
<p>Return <em>the <strong>number of strings</strong> in</em> <code>words</code> <em>that are a <strong>prefix</strong> of</em> <code>s</code>.</p>
4+
5+
<p>A <strong>prefix</strong> of a string is a substring that occurs at the beginning of the string. A <b>substring</b> is a contiguous sequence of characters within a string.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong>Example 1:</strong></p>
9+
10+
<pre>
11+
<strong>Input:</strong> words = [&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;ab&quot;,&quot;bc&quot;,&quot;abc&quot;], s = &quot;abc&quot;
12+
<strong>Output:</strong> 3
13+
<strong>Explanation:</strong>
14+
The strings in words which are a prefix of s = &quot;abc&quot; are:
15+
&quot;a&quot;, &quot;ab&quot;, and &quot;abc&quot;.
16+
Thus the number of strings in words which are a prefix of s is 3.</pre>
17+
18+
<p><strong>Example 2:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> words = [&quot;a&quot;,&quot;a&quot;], s = &quot;aa&quot;
22+
<strong>Output:</strong> 2
23+
<strong>Explanation:
24+
</strong>Both of the strings are a prefix of s.
25+
Note that the same string can occur multiple times in words, and it should be counted each time.</pre>
26+
27+
<p>&nbsp;</p>
28+
<p><strong>Constraints:</strong></p>
29+
30+
<ul>
31+
<li><code>1 &lt;= words.length &lt;= 1000</code></li>
32+
<li><code>1 &lt;= words[i].length, s.length &lt;= 10</code></li>
33+
<li><code>words[i]</code> and <code>s</code> consist of lowercase English letters <strong>only</strong>.</li>
34+
</ul>

0 commit comments

Comments
 (0)