Dsa
Prefix Sum
Warm-up
Sales Growth Tracker
A small business tracks its daily sales growth over a week. Write a program to calculate the total sales accumulated up to each day. The input will be a list of integers representing sales for each day. Output the accumulated sales for each day as a space-separated list.
Input format:
- A single line containing 7 integers, representing daily sales.
Output format:
- A single line with the total accumulated sales up to each day.
Example:
Input:
100 200 50 300 150 100 200
Output:
100 300 350 650 800 900 1100
Key concepts
prefix_sumcumulative_sumarray_processing
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