Dsa
Prefix Sum
Easy
Balance Check
Given a list representing account transactions, where positive values denote deposits and negative values denote withdrawals, write a program that calculates the final balance. The input starts with an integer indicating the number of transactions followed by the transactions themselves. If the final balance is less than zero, return 'Overdrawn', otherwise return your final balance.
Example Input:
4
50
-20
-10
10
Example Output:
30
Key concepts
prefix_sumarray
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