Holiday Prefix Sums

Prefix Sums Arrays Holiday Easy Coding

Problem: Holiday Prefix Sums

Imagine you're managing a holiday sale event. You have an array representing the sales for each day leading up to a major event, such as the winter solstice on December 21st. Your task is to implement a function that computes the prefix sums of the sales array. The prefix sum array at index i is the total sum of sales from day 0 up to day i.

Input

  • An array of integers representing daily sales.

Output

  • An array of integers where the i-th element is the sum of the first i+1 elements from the input array.

Example

For the input array: [5, 3, 7, 10], the prefix sums would be [5, 8, 15, 25].

Starter Task

Complete the function calculatePrefixSums (or similar in your chosen language) that takes the sales array as input and returns the prefix sum array.

Happy coding and enjoy the holiday season!