Dsa
Prefix Sum
Warm-up
Weekly Exercise Minutes
You are logging your weekly exercise minutes. Given the number of minutes you exercised each day for a week, write a program that computes the total minutes exercised as of each day. The program should print these cumulative totals.
Input format:
- A single line containing 7 integers indicating daily exercise minutes.
Output format:
- A single line with the cumulative minutes up to each day.
Example:
Input:
30 45 60 15 90 30 25
Output:
30 75 135 150 240 270 295
Key concepts
prefix_sumarray_summationhealth_tracking
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