Question bank › Prefix Sum
Dsa Prefix Sum Easy

Weather Temperature Trends

You are analyzing temperature data over a week. Given the daily temperature changes from day to day, calculate the cumulative temperature for each day starting from an initial value of 20 degrees. Output the cumulative temperature levels for each day. Input format: - The first line contains an integer, N (1 <= N <= 7), representing the number of days. - The second line contains N space-separated integers representing the change in temperature for each day (-30 <= Ai <= 30). Output format: - Output N space-separated integers representing the cumulative temperature levels for each day. Example: Input: 7 2 -1 3 0 -5 4 1 Output: 22 21 24 24 19 23 24

Key concepts

prefix_sumcumulative_sum

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.