Dsa
Prefix Sum
Easy
Market Profit Pivot
A trader analyzes N days of revenue. They want to find 'Pivot Points'. A pivot point is an index k (1 <= k < N) such that the total revenue from day 1 to day k is strictly greater than the total revenue from day k+1 to day N. Count how many such pivot points exist.
Input Format:
- Line 1: An integer N.
- Line 2: N integers representing daily revenue.
Output Format:
- An integer representing the count of valid pivot points.
Example:
Input:
4
10 -5 15 5
Output:
1
Key concepts
prefix_sumsuffix_sum
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now