Sponsored
Sponsored
Solve with full IDE support and test cases
Use these hints if you're stuck. Try solving on your own first.
Let <code>dp[i]</code> denote the energy we gain starting from index <code>i</code>.
We can notice, that <code> dp[i] = dp[i + k] + energy[i]</code>.