Question: PnL [ i ] represents the ith month profits or loss. We can perform the following operation on the PnL array any number of times:
PnLi represents the ith month profits or loss. We can perform the following operation on the PnL array any number of times: choose any month i i and i
Few test inputs and outputs:
N PnL
Output :
Because leads to a cumulative PnL of which has a negative cumulative pnl at last month
And leads to a cumulative pnl of and is invalid as cumulative PnL of first three months are negative
N PnL
Output :
As PnL of or leads to answer.
N PnL
Output:
Please give brute force and most optimal java code separately for it
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
