Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6fd5468

Browse files
author
Shuo
authored
Merge pull request #562 from openset/develop
Update: description
2 parents 8634fc7 + b86f056 commit 6fd5468

File tree

4 files changed

+65
-76
lines changed

4 files changed

+65
-76
lines changed

‎problems/detect-capital/README.md‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,38 @@
1111

1212
## 520. Detect Capital (Easy)
1313

14-
<p>
15-
Given a word, you need to judge whether the usage of capitals in it is right or not.
16-
</p>
14+
<p>Given a word, you need to judge whether the usage of capitals in it is right or not.</p>
15+
16+
<p>We define the usage of capitals in a word to be right when one of the following cases holds:</p>
1717

18-
<p>
19-
We define the usage of capitals in a word to be right when one of the following cases holds:
2018
<ol>
21-
<li>All letters in this word are capitals, like "USA".</li>
22-
<li>All letters in this word are not capitals, like "leetcode".</li>
23-
<li>Only the first letter in this word is capital if it has more than one letter, like "Google".</li>
19+
<li>All letters in this word are capitals, like &quot;USA&quot;.</li>
20+
<li>All letters in this word are not capitals, like &quot;leetcode&quot;.</li>
21+
<li>Only the first letter in this word is capital, like &quot;Google&quot;.</li>
2422
</ol>
25-
Otherwise, we define that this word doesn't use capitals in a right way.
26-
</p>
23+
Otherwise, we define that this word doesn&#39;t use capitals in a right way.
24+
25+
<p>&nbsp;</p>
2726

27+
<p><b>Example 1:</b></p>
2828

29-
<p><b>Example 1:</b><br />
3029
<pre>
31-
<b>Input:</b> "USA"
30+
<b>Input:</b> &quot;USA&quot;
3231
<b>Output:</b> True
3332
</pre>
34-
</p>
3533

36-
<p><b>Example 2:</b><br />
34+
<p>&nbsp;</p>
35+
36+
<p><b>Example 2:</b></p>
37+
3738
<pre>
38-
<b>Input:</b> "FlaG"
39+
<b>Input:</b> &quot;FlaG&quot;
3940
<b>Output:</b> False
4041
</pre>
41-
</p>
4242

43-
<p><b>Note:</b>
44-
The input will be a non-empty word consisting of uppercase and lowercase latin letters.
45-
</p>
43+
<p>&nbsp;</p>
44+
45+
<p><b>Note:</b> The input will be a non-empty word consisting of uppercase and lowercase latin letters.</p>
4646

4747
### Related Topics
4848
[[String](https://github.com/openset/leetcode/tree/master/tag/string/README.md)]

‎problems/falling-squares/README.md‎

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,52 @@
1212
## 699. Falling Squares (Hard)
1313

1414
<p>On an infinite number line (x-axis), we drop given squares in the order they are given.</p>
15+
1516
<p>The <code>i</code>-th square dropped (<code>positions[i] = (left, side_length)</code>) is a square with the left-most point being <code>positions[i][0]</code> and sidelength <code>positions[i][1]</code>.</p>
16-
<p>The square is dropped with the bottom edge parallel to the number line, and from a higher height than all currently landed squares. We wait for each square to stick before dropping the next.</p>
17-
<p>The squares are infinitely sticky on their bottom edge, and will remain fixed to any positive length surface they touch (either the number line or another square). Squares dropped adjacent to each other will not stick together prematurely.</p>
1817

19-
<br>
20-
<p>Return a list <code>ans</code> of heights. Each height <code>ans[i]</code> represents the current highest height of any square we have dropped, after dropping squares represented by <code>positions[0], positions[1], ..., positions[i]</code>.
21-
</p>
18+
<p>The square is dropped with the bottom edge parallel to the number line, and from a higher height than all currently landed squares. We wait for each square to stick before dropping the next.</p>
19+
20+
<p>The squares are infinitely sticky on their bottom edge, and will remain fixed to any positive length surface they touch (either the number line or another square). Squares dropped adjacent to each other will not stick together prematurely.</p>
21+
&nbsp;
22+
23+
<p>Return a list <code>ans</code> of heights. Each height <code>ans[i]</code> represents the current highest height of any square we have dropped, after dropping squares represented by <code>positions[0], positions[1], ..., positions[i]</code>.</p>
24+
25+
<p><b>Example 1:</b></p>
2226

23-
<p><b>Example 1:</b><br />
2427
<pre>
2528
<b>Input:</b> [[1, 2], [2, 3], [6, 1]]
2629
<b>Output:</b> [2, 5, 5]
2730
<b>Explanation:</b>
28-
<p>
29-
After the first drop of <code>positions[0] = [1, 2]:
30-
_aa
31-
_aa
32-
-------
33-
</code>The maximum height of any square is 2.
34-
</p><p>
35-
After the second drop of <code>positions[1] = [2, 3]:
36-
__aaa
37-
__aaa
38-
__aaa
39-
_aa__
40-
_aa__
41-
--------------
42-
</code>The maximum height of any square is 5.
43-
The larger square stays on top of the smaller square despite where its center
44-
of gravity is, because squares are infinitely sticky on their bottom edge.
45-
</p><p>
46-
After the third drop of <code>positions[1] = [6, 1]:
47-
__aaa
48-
__aaa
49-
__aaa
50-
_aa
51-
_aa___a
52-
--------------
53-
</code>The maximum height of any square is still 5.
54-
55-
Thus, we return an answer of <code>[2, 5, 5]</code>.
5631
</pre>
57-
</p>
5832

59-
<br>
33+
<p>After the first drop of <code>positions[0] = [1, 2]: _aa _aa ------- </code>The maximum height of any square is 2.</p>
34+
35+
<p>After the second drop of <code>positions[1] = [2, 3]: __aaa __aaa __aaa _aa__ _aa__ -------------- </code>The maximum height of any square is 5. The larger square stays on top of the smaller square despite where its center of gravity is, because squares are infinitely sticky on their bottom edge.</p>
36+
37+
<p>After the third drop of <code>positions[1] = [6, 1]: __aaa __aaa __aaa _aa _aa___a -------------- </code>The maximum height of any square is still 5. Thus, we return an answer of <code>[2, 5, 5]</code>.</p>
38+
39+
<p>&nbsp;</p>
40+
&nbsp;
41+
42+
<p><b>Example 2:</b></p>
6043

61-
<p><b>Example 2:</b><br />
6244
<pre>
6345
<b>Input:</b> [[100, 100], [200, 100]]
6446
<b>Output:</b> [100, 100]
65-
<b>Explanation:</b> Adjacent squares don't get stuck prematurely - only their bottom edge can stick to surfaces.
47+
<b>Explanation:</b> Adjacent squares don&#39;t get stuck prematurely - only their bottom edge can stick to surfaces.
6648
</pre>
67-
</p>
6849

69-
<p><b>Note:</b>
70-
<li><code>1 <= positions.length <= 1000</code>.</li>
71-
<li><code>1 <= positions[i][0] <= 10^8</code>.</li>
72-
<li><code>1 <= positions[i][1] <= 10^6</code>.</li>
73-
</p>
50+
<p>&nbsp;</p>
51+
52+
<p><b>Note:</b></p>
53+
54+
<ul>
55+
<li><code>1 &lt;= positions.length &lt;= 1000</code>.</li>
56+
<li><code>1 &lt;= positions[i][0] &lt;= 10^8</code>.</li>
57+
<li><code>1 &lt;= positions[i][1] &lt;= 10^6</code>.</li>
58+
</ul>
59+
60+
<p>&nbsp;</p>
7461

7562
### Related Topics
7663
[[Segment Tree](https://github.com/openset/leetcode/tree/master/tag/segment-tree/README.md)]

‎problems/lru-cache/README.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@
1111

1212
## 146. LRU Cache (Hard)
1313

14-
<p>
15-
Design and implement a data structure for <a href="https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU" target="_blank">Least Recently Used (LRU) cache</a>. It should support the following operations: <code>get</code> and <code>put</code>.
16-
</p>
14+
<p>Design and implement a data structure for <a href="https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU" target="_blank">Least Recently Used (LRU) cache</a>. It should support the following operations: <code>get</code> and <code>put</code>.</p>
1715

18-
<p>
19-
<code>get(key)</code> - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.<br>
20-
<code>put(key, value)</code> - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item.
21-
</p>
16+
<p><code>get(key)</code> - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.<br />
17+
<code>put(key, value)</code> - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item.</p>
18+
19+
<p>The cache is initialized with a <strong>positive</strong> capacity.</p>
2220

2321
<p><b>Follow up:</b><br />
2422
Could you do both operations in <b>O(1)</b> time complexity?</p>
2523

26-
<p><b>Example:</b>
24+
<p><b>Example:</b></p>
25+
2726
<pre>
2827
LRUCache cache = new LRUCache( 2 /* capacity */ );
2928

@@ -37,7 +36,8 @@ cache.get(1); // returns -1 (not found)
3736
cache.get(3); // returns 3
3837
cache.get(4); // returns 4
3938
</pre>
40-
</p>
39+
40+
<p>&nbsp;</p>
4141

4242
### Related Topics
4343
[[Design](https://github.com/openset/leetcode/tree/master/tag/design/README.md)]

‎problems/minimum-number-of-arrows-to-burst-balloons/README.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111

1212
## 452. Minimum Number of Arrows to Burst Balloons (Medium)
1313

14-
<p>There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordinates don't matter and hence the x-coordinates of start and end of the diameter suffice. Start is always smaller than end. There will be at most 10<sup>4</sup> balloons.</p>
14+
<p>There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it&#39;s horizontal, y-coordinates don&#39;t matter and hence the x-coordinates of start and end of the diameter suffice. Start is always smaller than end. There will be at most 10<sup>4</sup> balloons.</p>
1515

16-
<p>An arrow can be shot up exactly vertically from different points along the x-axis. A balloon with x<sub>start</sub> and x<sub>end</sub> bursts by an arrow shot at x if x<sub>start</sub> &le; x &le; x<sub>end</sub>. There is no limit to the number of arrows that can be shot. An arrow once shot keeps travelling up infinitely. The problem is to find the minimum number of arrows that must be shot to burst all balloons. </p>
16+
<p>An arrow can be shot up exactly vertically from different points along the x-axis. A balloon with x<sub>start</sub> and x<sub>end</sub> bursts by an arrow shot at x if x<sub>start</sub> &le; x &le; x<sub>end</sub>. There is no limit to the number of arrows that can be shot. An arrow once shot keeps travelling up infinitely. The problem is to find the minimum number of arrows that must be shot to burst all balloons.</p>
17+
18+
<p><b>Example:</b></p>
1719

18-
<p><b>Example:</b>
1920
<pre>
2021
<b>Input:</b>
2122
[[10,16], [2,8], [1,6], [7,12]]
@@ -26,7 +27,8 @@
2627
<b>Explanation:</b>
2728
One way is to shoot one arrow for example at x = 6 (bursting the balloons [2,8] and [1,6]) and another arrow at x = 11 (bursting the other two balloons).
2829
</pre>
29-
</p>
30+
31+
<p>&nbsp;</p>
3032

3133
### Related Topics
3234
[[Greedy](https://github.com/openset/leetcode/tree/master/tag/greedy/README.md)]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /