Question bank › Prefix Sum
Dsa Prefix Sum Warm-up

Water Consumption Tracker

You are monitoring your water intake over a week. Write a program that calculates the total amount of water consumed by the end of each day, given an array representing your daily water consumption in liters. The program should output the cumulative water intake for each day. Input format: - A single line of 7 integers representing daily water consumption in liters. Output format: - A single line with cumulative water consumption, separated by spaces. Example: Input: 1 2 1 3 2 1 4 Output: 1 3 4 7 9 10 14

Key concepts

prefix_sumcumulative_sumdaily_tracking

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.