We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a67438a commit 781f1bcCopy full SHA for 781f1bc
C++/number-of-music-playlists.cpp
@@ -14,7 +14,7 @@ class Solution {
14
dp[n % 2][n] = (dp[(n - 1) % 2][n - 1] * n) % M;
15
for (int l = n + 1; l <= L; ++l) {
16
dp[n % 2][l] = ((dp[n % 2][l - 1] * max(n - K, 0)) % M +
17
- (dp[(n - 1) % 2][l - 1] * n) % M) % M;
+ (dp[(n - 1) % 2][l - 1] * n) % M) % M;
18
}
19
20
return dp[N % 2][L];
0 commit comments