Question bank › Prefix Sum
Dsa Prefix Sum Easy

Daily Caloric Intake Tracker

You are working on a health application that tracks the daily caloric intake of users. For a set of days, your task is to compute the total calories consumed up to each day. Input: - The first line contains an integer D (1 <= D <= 100), the number of days. - The second line contains D space-separated integers representing the caloric intake for each day. Output: - Print D space-separated integers where the i-th integer is the cumulative caloric intake up to day i. Example Input: 5 2000 1800 2500 2200 3000 Example Output: 2000 3800 6300 8500 11500

Key concepts

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