pls explain answers for q6 & 9?
Explaination needed
Answer for q6 in practise should be O(n^2) but if we are talking about saving space hypothetically then we need only O(n^2/2) space , because we need to fill only one half of the table , other half is exact copy of it.
dp[i][j]=dp[j][i].
Now for ques 9, multiply -2 1 -6 by -2 to get new array
-3 8 4 -2 12
now max subarray sum 8+4±2+12=22
The code for this is https://www.geeksforgeeks.org/maximize-the-subarray-sum-after-multiplying-all-elements-of-any-subarray-with-x/
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.