Skip to content

Commit 9c24b4b

Browse files
committed
deploy: f1b58d0
1 parent cb940a3 commit 9c24b4b

File tree

10 files changed

+7764
-7448
lines changed

10 files changed

+7764
-7448
lines changed

en/lc/370/index.html

Lines changed: 260 additions & 112 deletions
Large diffs are not rendered by default.

en/search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

en/sitemap.xml

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

en/sitemap.xml.gz

0 Bytes
Binary file not shown.

lc/370/index.html

Lines changed: 244 additions & 106 deletions
Large diffs are not rendered by default.

lc/850/index.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85820,6 +85820,36 @@ <h3 id="_3">方法一:离散化 + 线段树 + 扫描线</h3>
8582085820

8582185821

8582285822

85823+
<aside class="md-source-file">
85824+
85825+
85826+
85827+
85828+
85829+
<span class="md-source-file__fact">
85830+
85831+
85832+
<span class="md-icon" title="贡献者">
85833+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34-.46-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.87 1.52 2.34 1.07 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.92 0-1.11.38-2 1.03-2.71-.1-.25-.45-1.29.1-2.64 0 0 .84-.27 2.75 1.02.79-.22 1.65-.33 2.5-.33s1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02.55 1.35.2 2.39.1 2.64.65.71 1.03 1.6 1.03 2.71 0 3.82-2.34 4.66-4.57 4.91.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2"/></svg>
85834+
</span>
85835+
<span>GitHub</span>
85836+
85837+
85838+
<nav>
85839+
85840+
<a href="https://github.com/yanglbme" class="md-author" title="@yanglbme">
85841+
85842+
<img src="https://avatars.githubusercontent.com/u/21008209?v=4&size=72" alt="yanglbme">
85843+
</a>
85844+
85845+
85846+
85847+
</nav>
85848+
</span>
85849+
85850+
85851+
</aside>
85852+
8582385853

8582485854

8582585855

lcof/46/index.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85060,11 +85060,11 @@ <h2 id="_2">解法</h2>
8506085060

8506185061
<h3 id="_3">方法一:记忆化搜索</h3>
8506285062
<p>我们先将数字 <code>num</code> 转为字符串 $s$,字符串 $s$ 的长度记为 $n$。</p>
85063-
<p>然后我们设计一个函数 $dfs(i)$,表示从第 $i$ 个数字开始的不同翻译的数目。那么答案就是 $dfs(0)$。</p>
85063+
<p>然后我们设计一个函数 $dfs(i)$,表示从索引为 $i$ 的数字开始的不同翻译的数目。那么答案就是 $dfs(0)$。</p>
8506485064
<p>函数 $dfs(i)$ 的计算如下:</p>
8506585065
<ul>
85066-
<li>如果 $i \ge n - 1$,说明已经翻译到最后一个数字,只有一种翻译方法,返回 $1$;</li>
85067-
<li>否则,我们可以选择翻译第 $i$ 个数字,此时翻译方法数目为 $dfs(i + 1)$;如果第 $i$ 个数字和第 $i + 1$ 个数字可以组成一个有效的字符(即 $s[i] == 1$ 或者 $s[i] == 2$ 且 $s[i + 1] \lt 6$),那么我们还可以选择翻译第 $i$ 和第 $i + 1$ 个数字,此时翻译方法数目为 $dfs(i + 2)$。因此 $dfs(i) = dfs(i+1) + dfs(i+2)$。</li>
85066+
<li>如果 $i \ge n - 1$,说明已经翻译到最后一个数字或者越过最后一个字符,均只有一种翻译方法,返回 $1$;</li>
85067+
<li>否则,我们可以选择翻译索引为 $i$ 的数字,此时翻译方法数目为 $dfs(i + 1)$;如果索引为 $i$ 的数字和索引为 $i + 1$ 的数字可以组成一个有效的字符(即 $s[i] == 1$ 或者 $s[i] == 2$ 且 $s[i + 1] \lt 6$),那么我们还可以选择翻译索引为 $i$ 和索引为 $i + 1$ 的数字,此时翻译方法数目为 $dfs(i + 2)$。因此 $dfs(i) = dfs(i+1) + dfs(i+2)$。</li>
8506885068
</ul>
8506985069
<p>过程中我们可以使用记忆化搜索,将已经计算过的 $dfs(i)$ 的值存储起来,避免重复计算。</p>
8507085070
<p>时间复杂度 $O(\log num)$,空间复杂度 $O(\log num)$。其中 $num$ 为给定的数字。</p>
@@ -85743,6 +85743,11 @@ <h3 id="_4">方法二:动态规划</h3>
8574385743

8574485744
<nav>
8574585745

85746+
<a href="https://github.com/lingxier" class="md-author" title="@lingxier">
85747+
85748+
<img src="https://avatars.githubusercontent.com/u/50407509?v=4&size=72" alt="lingxier">
85749+
</a>
85750+
8574685751
<a href="https://github.com/klever34" class="md-author" title="@klever34">
8574785752

8574885753
<img src="https://avatars.githubusercontent.com/u/12745225?v=4&size=72" alt="klever34">
@@ -85758,16 +85763,11 @@ <h3 id="_4">方法二:动态规划</h3>
8575885763
<img src="https://avatars.githubusercontent.com/u/85606371?v=4&size=72" alt="xiongbinzou">
8575985764
</a>
8576085765

85761-
<a href="https://github.com/YangFong" class="md-author" title="@YangFong">
85762-
85763-
<img src="https://avatars.githubusercontent.com/u/70502828?v=4&size=72" alt="YangFong">
85764-
</a>
85765-
8576685766

8576785767

8576885768

8576985769
<a href="https://github.com/doocs/leetcode/blob/main/lcof/%E9%9D%A2%E8%AF%95%E9%A2%9846.%20%E6%8A%8A%E6%95%B0%E5%AD%97%E7%BF%BB%E8%AF%91%E6%88%90%E5%AD%97%E7%AC%A6%E4%B8%B2/README.md" class="md-author md-author--more">
85770-
+2
85770+
+3
8577185771
</a>
8577285772

8577385773

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)