Dsa
Prefix Sum
Warm-up
Temperature Fluctuation
You receive daily temperature changes for a week. You need to determine the total temperature change by the end of each day of the week. The temperature change for a given day can be positive (increase) or negative (decrease).
Input:
- A single line containing 7 integers representing the daily temperature changes.
Output:
- A single line containing 7 integers, where each integer shows the total temperature change by the end of that day.
Example:
Input:
2 -1 3 1 -4 2 5
Output:
2 1 4 5 1 3 8
Key concepts
prefix_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