Question bank › Prefix Sum
Dsa Prefix Sum Easy

Cumulative Inventory Management

You run an inventory management system for a store and need to track the changes in inventory levels. Given an initial inventory level and a list of daily changes (positive for additions, negative for removals), compute the inventory level after each day. Output the cumulative inventory levels for each day. 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, where the ith integer (Ai) represents the change in inventory for day i (-1000 <= Ai <= 1000). Output format: - Output N space-separated integers representing the cumulative inventory levels after each day starting from the initial level of 0. Example: Input: 5 10 -5 15 -3 2 Output: 10 5 20 17 19

Key concepts

prefix_sumarray_manipulation

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.