Skip to content

Commit b19a67b

Browse files
authored
Update Candies Explanation.txt
1 parent 97abf9d commit b19a67b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Contests/Educational DP Contest/Explanations/Candies Explanation.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Then we can give the i-th person - 0, 1, 2, ... , A[i] chocolates.
44

55
So, f(i, j) = f(i - 1, j ) + f(i - 1, j - 1) + ... + f(i - 1, j - A[i] - 1)
66

7-
If (j - A[i] - 1), then f(i, j) = f(i - 1, j) + ... + f(i - 1, 0).
7+
If (j = A[i] - 1), then f(i, j) = f(i - 1, j) + ... + f(i - 1, 0).
88

99
So the base case is that f(0, 0) = 1 and f(0, j) = 0 for all other j.
1010

0 commit comments

Comments
 (0)