Dsa
Prefix Sum
Easy
Construction Project Timeline
You are managing a construction project that reports the number of completed tasks each day. Given the number of tasks completed each day, compute the cumulative total of completed tasks by the end of each day.
Input format:
- The first line contains an integer, D (1 <= D <= 100), representing the number of days.
- The second line contains D space-separated integers representing the number of tasks completed on each day (0 <= Ai <= 100).
Output format:
- Output D space-separated integers representing the cumulative number of completed tasks after each day.
Example:
Input:
4
5 3 8 2
Output:
5 8 16 18
Key concepts
prefix_sumrunning_total
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