Maximize Negative PnL Months
Problem Overview
- Determine the maximum number of months to flip to negative in a positive PnL array so every cumulative PnL stays strictly above zero.
- Input: int[] PnL with 1 <= n <= 10 and 1 <= PnL[i] <= 1e9; Output: int count of months that can be negative under the prefix constraint.
- Context: Analyze monthly PnL of an Amazon stock portfolio generated by an AWS financial model.
- This Amazon interviews problem is a common coding interview interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
