Skip to content

Commit cdb0e0b

Browse files
A1exL1angbqi343
andauthored
Update content/6_Advanced/Lagrange.mdx
Co-authored-by: Benjamin Qi <bqi343@gmail.com>
1 parent d8c72d0 commit cdb0e0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/6_Advanced/Lagrange.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The problem gives us a length $N$ ($1 \le N \le 3 \cdot 10^5$) array of integers
3535

3636
The main bottleneck of any dynamic programming solution to this problem is having to store the number of subarrays we have created so far.
3737

38-
Let's try to find a way around this. Instead of storing the number of subarrays we have created so far, we assign a penalty of $\lambda$ for creating a new subarray (i.e. everytime we create a subarray we penalize our sum by $\lambda$).
38+
Let's try to find a way around this. Instead of storing the number of subarrays we have created so far, we assign a penalty of $\lambda$ for creating a new subarray (i.e. every time we create a subarray we penalize our sum by $\lambda$).
3939

4040
This leads us to the sub-problem of finding the maximal sum and number of subarrays used if creating a new subarray costs $\lambda$. We can solve this in $\mathcal{O}(N)$ time with dynamic programming.
4141

0 commit comments

Comments
 (0)