Round 1
Questions: Specific question not provided.
Follow-up Question
- Can anyone help with a solution for the Amazon OA question?
Test Cases:
- Another PnL array sample = [5, 2, 3, 5, 2, 3]
- All values in PnL array are positive. 1 <= PnL[i] <= 10^9
Candidate's Approach
The candidate implemented a function getMaxNegativePnL
that attempts to calculate the maximum number of negative counts based on a cumulative sum. However, they noted that the code does not cover all test cases.
def getMaxNegativePnL(PnL): cumulative_sum = 0 negative_count = 0 for num in PnL: cumulative_sum += num if cumulative_sum - 2*num > 0: negative_count += 1 cumulative_sum -= 2*num return negative_count
Interviewer's Feedback
No feedback provided.