Question bank › Prefix Sum
Dsa Prefix Sum Easy

Book Reading Time Calculation

You are tasked with calculating the total reading time for a series of books. Each book has an associated reading time in minutes. You need to return the amount of time it takes to read all the books incrementally up to each book. Input: - The first line contains an integer N (1 <= N <= 1000), the number of books. - The second line contains N space-separated integers representing the reading times for each book. Output: - Print N space-separated integers where the i-th integer is the total time spent reading the first i books. Example Input: 3 30 45 15 Example Output: 30 75 90

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.