Skip to content

Commit 58c1c88

Browse files
yanglbmeidoocs
andauthoredMay 23, 2024
feat: update lc problems (doocs#2889)
--------- Co-authored-by: Doocs Bot <doocs-bot@outlook.com>
1 parent dd5b306 commit 58c1c88

File tree

56 files changed

+323
-895
lines changed

Some content is hidden

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

56 files changed

+323
-895
lines changed
 

‎lcof2/剑指 Offer II 089. 房屋偷盗/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ $$
7777

7878
时间复杂度 $O(n)$,空间复杂度 $O(n)$。其中 $n$ 是数组长度。
7979

80-
注意到当 $i \gt 2$ 时,$f[i]$ 只和 $f[i-1]$ 与 $f[i-2]$ 有关,因此我们可以使用两个变量代替数组,将空间复杂度降到 $O(1)$。
81-
8280
<!-- tabs:start -->
8381

8482
#### Python3
@@ -176,7 +174,9 @@ impl Solution {
176174

177175
<!-- solution:start-->
178176

179-
### 方法二
177+
### 方法二:动态规划(空间优化)
178+
179+
我们注意到,当 $i \gt 2$ 时,$f[i]$ 只和 $f[i-1]$ 与 $f[i-2]$ 有关,因此我们可以使用两个变量代替数组,将空间复杂度降到 $O(1)$。
180180

181181
<!-- tabs:start -->
182182

‎solution/0100-0199/0165.Compare Version Numbers/README_EN.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ tags:
1717

1818
<!-- description:start -->
1919

20-
<p>Given two <strong>version strings</strong>,&nbsp;<code>version1</code> and <code>version2</code>, compare them. A version string consists of <strong>revisions</strong> separated by dots <code>&#39;.&#39;</code>. The <strong>value of the revision</strong> is its <strong>integer conversion</strong> ignoring leading zeros.</p>
20+
<p>Given two <strong>version strings</strong>, <code>version1</code> and <code>version2</code>, compare them. A version string consists of <strong>revisions</strong> separated by dots <code>&#39;.&#39;</code>. The <strong>value of the revision</strong> is its <strong>integer conversion</strong> ignoring leading zeros.</p>
2121

2222
<p>To compare version strings, compare their revision values in <strong>left-to-right order</strong>. If one of the version strings has fewer revisions, treat the missing revision values as <code>0</code>.</p>
2323

24-
<p><em>Return the following:</em></p>
24+
<p>Return the following:</p>
2525

2626
<ul>
27-
<li>If <code>version1 &lt; version2</code>, return <code>-1</code>.</li>
28-
<li>If <code>version1 &gt; version2</code>, return <code>1</code>.</li>
29-
<li>Otherwise, return <code>0</code>.</li>
27+
<li>If <code>version1 &lt; version2</code>, return -1.</li>
28+
<li>If <code>version1 &gt; version2</code>, return 1.</li>
29+
<li>Otherwise, return 0.</li>
3030
</ul>
3131

3232
<p>&nbsp;</p>

0 commit comments

Comments
 (0)