Question bank › Prefix Sum
Dsa Prefix Sum Easy

Weekly Sales Performance

You are analyzing weekly sales data for a product over several weeks. You need to calculate the total sales amount accumulated by the end of each week. Input: - The first line contains an integer W (1 <= W <= 52), the number of weeks. - The second line contains W space-separated integers representing the sales for each week. Output: - Print W space-separated integers representing the accumulated sales amount after each week. Example Input: 4 300 400 500 600 Example Output: 300 700 1200 1800

Key concepts

prefix_sumarrayscumulative_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.