Skip to content

添加0377.组合总和Ⅳ C++ 版本 #2953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion problems/0377.组合总和Ⅳ.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ public:
dp[0] = 1;
for (int i = 0; i <= target; i++) { // 遍历背包
for (int j = 0; j < nums.size(); j++) { // 遍历物品
if (i - nums[j] >= 0 && dp[i] < INT_MAX - dp[i - nums[j]]) {
// INT_MAX需取等,以包含leecode所有溢出情况
if (i - nums[j] >= 0 && dp[i] <= INT_MAX - dp[i - nums[j]]) {
dp[i] += dp[i - nums[j]];
}
}
Expand Down
2 changes: 1 addition & 1 deletion problems/kamacoder/0098.所有可达路径.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ while (m--) {

```CPP
vector<vector<int>> result; // 收集符合条件的路径
vector<int> path; // 0节点到终点的路径
vector<int> path; // 1节点到终点的路径
// x:目前遍历的节点
// graph:存当前的图
// n:终点
Expand Down