Skip to content

Commit 4a203da

Browse files
committed
update
1 parent d29ab34 commit 4a203da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/shopping-offers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class Solution {
1515

1616
int result = shoppingOffersHelper(price, special, needs, i + 1);
1717

18-
for (int j = 0; j < special[i].size() - 1; ++j) {
18+
for (int j = 0; j < needs.size(); ++j) {
1919
needs[j] -= special[i][j];
2020
}
2121
if (all_of(needs.begin(), needs.end(), [](int i) { return i >= 0; })) {
2222
result = min(result, special[i].back() + shoppingOffersHelper(price, special, needs, i));
2323
}
24-
for (int j = 0; j < special[i].size() - 1; ++j) {
24+
for (int j = 0; j < needs.size(); ++j) {
2525
needs[j] += special[i][j];
2626
}
2727

0 commit comments

Comments
 (0)