Solution1 DP
replace: ends with n and must replaced one
nonreplace: ends with n and must not replaced
for replace, there are three cases:
n * n
: replace current n, and start this as new subarray.n * n + nonreplace
: replace current n and plus former nonreplace subarray.n + replace
: already replaced before and add current n to subarray.
for nonreplace, there are only two cases:
n
: n start as a new subarray.n + nonreplace
: n plus former nonreplace subarray.
Previous1746_Maximum_Subarray_Sum_After_One_OperationNext1770_Maximum_Score_from_Performing_Multiplication_Operations
Last updated