Question bank › Prefix Sum
Dsa Prefix Sum Easy

Cumulative Order Total

You are tasked with calculating the cumulative total of orders at a small cafe over a week. Each order can be positive (revenue) or negative (refunds) and is represented as a list of integers. Write a program that takes as input the number of orders followed by the orders themselves. Output the cumulative total after processing all orders. Example Input: 5 20 -5 15 -10 30 Example Output: 50

Key concepts

prefix_sumarraycumulative_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
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.