File tree Expand file tree Collapse file tree 7 files changed +11
-11
lines changed Expand file tree Collapse file tree 7 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1616| 0322 | [ 零钱兑换] ( https://leetcode.cn/problems/coin-change/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0322 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0322.md ) | 广度优先搜索、数组、动态规划 | 中等 |
1717| 0518 | [ 零钱兑换 II] ( https://leetcode.cn/problems/coin-change-ii/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0518 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0518.md ) | 数组、动态规划 | 中等 |
1818| 0139 | [ 单词拆分] ( https://leetcode.cn/problems/word-break/ ) | | 字典树、记忆化搜索、数组、哈希表、字符串、动态规划 | 中等 |
19- | 0377 | [ 组合总和 Ⅳ ] ( https://leetcode.cn/problems/combination-sum-iv/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0377 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0377.md ) | 数组、动态规划 | 中等 |
19+ | 0377 | [ 组合总和 IV ] ( https://leetcode.cn/problems/combination-sum-iv/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0377 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0377.md ) | 数组、动态规划 | 中等 |
2020| 0638 | [ 大礼包] ( https://leetcode.cn/problems/shopping-offers/ ) | | 位运算、记忆化搜索、数组、动态规划、回溯、状态压缩 | 中等 |
2121| 1449 | [ 数位成本和为目标值的最大数字] ( https://leetcode.cn/problems/form-largest-integer-with-digits-that-add-up-to-target/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/1449 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/1449.md ) | 数组、动态规划 | 困难 |
2222
Original file line number Diff line number Diff line change 844844| 0322 | [ 零钱兑换] ( https://leetcode.cn/problems/coin-change/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0322 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0322.md ) | 广度优先搜索、数组、动态规划 | 中等 |
845845| 0518 | [ 零钱兑换 II] ( https://leetcode.cn/problems/coin-change-ii/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0518 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0518.md ) | 数组、动态规划 | 中等 |
846846| 0139 | [ 单词拆分] ( https://leetcode.cn/problems/word-break/ ) | | 字典树、记忆化搜索、数组、哈希表、字符串、动态规划 | 中等 |
847- | 0377 | [ 组合总和 Ⅳ ] ( https://leetcode.cn/problems/combination-sum-iv/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0377 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0377.md ) | 数组、动态规划 | 中等 |
847+ | 0377 | [ 组合总和 IV ] ( https://leetcode.cn/problems/combination-sum-iv/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0377 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0377.md ) | 数组、动态规划 | 中等 |
848848| 0638 | [ 大礼包] ( https://leetcode.cn/problems/shopping-offers/ ) | | 位运算、记忆化搜索、数组、动态规划、回溯、状态压缩 | 中等 |
849849| 1449 | [ 数位成本和为目标值的最大数字] ( https://leetcode.cn/problems/form-largest-integer-with-digits-that-add-up-to-target/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/1449 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/1449.md ) | 数组、动态规划 | 困难 |
850850
Original file line number Diff line number Diff line change 187187| 0371 | [ 两整数之和] ( https://leetcode.cn/problems/sum-of-two-integers/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0371 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0371.md ) | 位运算、数学 | 中等 |
188188| 0374 | [ 猜数字大小] ( https://leetcode.cn/problems/guess-number-higher-or-lower/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0374 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0374.md ) | 二分查找、交互 | 简单 |
189189| 0375 | [ 猜数字大小 II] ( https://leetcode.cn/problems/guess-number-higher-or-lower-ii/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0375 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0375.md ) | 数学、动态规划、博弈 | 中等 |
190- | 0377 | [ 组合总和 Ⅳ ] ( https://leetcode.cn/problems/combination-sum-iv/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0377 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0377.md ) | 数组、动态规划 | 中等 |
190+ | 0377 | [ 组合总和 IV ] ( https://leetcode.cn/problems/combination-sum-iv/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0377 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0377.md ) | 数组、动态规划 | 中等 |
191191| 0383 | [ 赎金信] ( https://leetcode.cn/problems/ransom-note/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0383 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0383.md ) | 哈希表、字符串、计数 | 简单 |
192192| 0384 | [ 打乱数组] ( https://leetcode.cn/problems/shuffle-an-array/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0384 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0384.md ) | 数组、数学、随机化 | 中等 |
193193| 0392 | [ 判断子序列] ( https://leetcode.cn/problems/is-subsequence/ ) | [ 网页链接] ( https://datawhalechina.github.io/leetcode-notes/#/solutions/0392 ) 、[ Github 链接] ( https://github.com/datawhalechina/leetcode-notes/blob/main/docs/solutions/0392.md ) | 双指针、字符串、动态规划 | 简单 |
Original file line number Diff line number Diff line change 1- # [ 0377. 组合总和 Ⅳ ] ( https://leetcode.cn/problems/combination-sum-iv/ )
1+ # [ 0377. 组合总和 IV ] ( https://leetcode.cn/problems/combination-sum-iv/ )
22
33- 标签:数组、动态规划
44- 难度:中等
55
66## 题目链接
77
8- - [ 0377. 组合总和 Ⅳ - 力扣] ( https://leetcode.cn/problems/combination-sum-iv/ )
8+ - [ 0377. 组合总和 IV - 力扣] ( https://leetcode.cn/problems/combination-sum-iv/ )
99
1010## 题目大意
1111
Original file line number Diff line number Diff line change 5858举例说明:
5959
6060- ` a / b = 2.0 ` :说明 $a == 2b$,$a$ 和 $b$ 在同一个集合。
61- - ` b / c = 3.0 ` :说明 $b == 3c$,$b$ 和 $c$ 在同一个集合。
61+ - ` b / c = 3.0 ` :说明 $b == 3c$,$b$ 和 $c$ 在同一个集合。
6262
6363根据上述两式可得:$a$、$b$、$c$ 都在一个集合中,且 $a == 2b == 6c$。
6464
Original file line number Diff line number Diff line change @@ -93,8 +93,8 @@ class Solution:
9393
9494举个例子:
9595
96- 1 . $n = 4, state = (1001)_ 2$,表示选择了数字 $1、 4$,剩余数字 $2$ 和 $3$ 未被选择。
97- 2 . $n = 6, state = (011010)_ 2$,表示选择了数字 $2、4、 5$,剩余数字 $1、3、 6$ 未被选择。
96+ 1 . $n = 4, state = (1001)_ 2$,表示选择了数字 $1$、$ 4$,剩余数字 $2$ 和 $3$ 未被选择。
97+ 2 . $n = 6, state = (011010)_ 2$,表示选择了数字 $2$、$4$、$ 5$,剩余数字 $1$、$3$、$ 6$ 未被选择。
9898
9999这样我们就可以使用 $n$ 位的二进制数 $state$ 来表示当前排列中数的选取情况。
100100
@@ -120,7 +120,7 @@ class Solution:
120120
121121###### 4. 初始条件
122122
123- - 不考虑任何数($i = 0, state = 0$)的情况下,方案数为 $1$。
123+ - 不考虑任何数($i = 0, state = 0$)的情况下,方案数为 $1$。
124124
125125###### 5. 最终结果
126126
@@ -173,7 +173,7 @@ class Solution:
173173
174174###### 3. 状态转移方程
175175
176- 对于状态 $state$,先统计出 $state$ 中选择的数字个数(即统计二进制中 $1$ 的个数)$one_num $。
176+ 对于状态 $state$,先统计出 $state$ 中选择的数字个数(即统计二进制中 $1$ 的个数)$one\underline{\hspace{0.5em}}num $。
177177
178178则 $dp[ state] $ 表示选择了前 $one\underline{\hspace{0.5em}}num$ 个数字,且选择情况为 $state$ 时的方案数。
179179
Original file line number Diff line number Diff line change @@ -90,5 +90,5 @@ class Solution:
9090
9191### 思路 1:复杂度分析
9292
93- - ** 时间复杂度** :$O( n^2 \times \alpha(n)) $。其中 $n$ 是城市的数量,$\alpha$ 是反 ` Ackerman ` 函数。
93+ - ** 时间复杂度** :$O( n^2 \times \alpha(n)) $。其中 $n$ 是城市的数量,$\alpha$ 是反 ` Ackerman ` 函数。
9494- ** 空间复杂度** :$O(n)$。
You can’t perform that action at this time.
0 commit comments