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
Hint 1
Think about dynamic programming
Hint 2
Define an array dp[nums.length][2], where dp[i][0] is the max subarray sum including nums[i] and without squaring any element.
Hint 3
dp[i][1] is the max subarray sum including nums[i] and having only one element squared.