Skip to content

Commit 3169dd8

Browse files
authored
Update number-of-ways-to-rearrange-sticks-with-k-sticks-visible.cpp
1 parent 7ea26f9 commit 3169dd8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/number-of-ways-to-rearrange-sticks-with-k-sticks-visible.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Solution {
1010
for (int i = 2; i <= n; ++i) {
1111
for (int j = 1; j <= min(i, k); ++j) {
1212
// choose the tallest as the last one which would be visible: dp[i-1][j-1]
13-
// choose the non-tallest as the last one which would be hidden: (i-1) * dp[i-1][j]
13+
// choose the non-tallest as the last one which would be hidden: (i-1)*dp[i-1][j]
1414
dp[i % 2][j] = (dp[(i - 1) % 2][j - 1] + int64_t(i - 1) * dp[(i - 1) % 2][j]) % MOD;
1515
}
1616
}

0 commit comments

Comments
 (0)