Dsa
Prefix Sum
Easy
Daily Step Count Tracking
You are tracking the daily step counts of users in a fitness app. Given the step counts for each day, compute the total steps taken after each day and output these cumulative totals.
Input format:
- The first line contains an integer, N (1 <= N <= 1000), representing the number of days.
- The second line contains N space-separated integers representing the steps taken on each day (0 <= Ai <= 10000).
Output format:
- Output N space-separated integers representing total steps taken after each day.
Example:
Input:
4
1000 2000 1500 2500
Output:
1000 3000 4500 7000
Key concepts
prefix_sumarray_prefix
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