You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/lc/3180/index.html
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -80312,7 +80312,7 @@ <h3 id="solution-3-dynamic-programming-bit-manipulation">Solution 3: Dynamic Pro
80312
80312
<p>Observing the state transition equation from Solution 2, $f[j] = f[j] \vee f[j - v]$, this is equivalent to taking the lower $v$ bits of $f$, shifting them left by $v$ bits, and then performing an OR operation with the original $f$.</p>
80313
80313
<p>Thus, the answer is the position of the highest bit in $f$.</p>
80314
80314
<p>The time complexity is $O(n \times M / w)$, and the space complexity is $O(n + M / w)$. Where $n$ is the length of the <code>rewardValues</code> array, $M$ is twice the maximum value in the <code>rewardValues</code> array, and the integer $w = 32$ or $64$.</p>
Copy file name to clipboardExpand all lines: en/lc/3181/index.html
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -79843,7 +79843,7 @@ <h3 id="solution-1-dynamic-programming-bit-manipulation">Solution 1: Dynamic Pro
79843
79843
<p>Observing the state transition equation $f[j] = f[j] \vee f[j - v]$, this is equivalent to taking the lower $v$ bits of $f$, shifting them left by $v$ bits, and then performing an OR operation with the original $f$.</p>
79844
79844
<p>Thus, the answer is the position of the highest bit in $f$.</p>
79845
79845
<p>The time complexity is $O(n \times M / w)$, and the space complexity is $O(n + M / w)$. Where $n$ is the length of the <code>rewardValues</code> array, $M$ is twice the maximum value in the <code>rewardValues</code> array, and the integer $w = 32$ or $64$.</p>
0 commit comments