We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 138d31a commit ec6ec30Copy full SHA for ec6ec30
C++/minimum-increments-for-target-multiples-in-an-array.cpp
@@ -29,7 +29,7 @@ class Solution {
29
// submask enumeration:
30
// => sum(nCr(n, k) * 2^k for k in xrange(n+1)) = (1 + 2)^n = 3^n
31
// => Time: O(3^n), see https://cp-algorithms.com/algebra/all-submasks.html
32
- int new_mask = ((1 << m) - 1) - mask;
+ const int new_mask = ((1 << m) - 1) - mask;
33
for (int submask = new_mask; submask; submask = (submask - 1) & new_mask) {
34
dp[mask | submask] = min(dp[mask | submask], dp[mask] + (x % lcms[submask] ? lcms[submask] - x % lcms[submask] : 0));
35
}
0 commit comments