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.
For the input array: [5, 3, 7, 10]
, the prefix sums would be [5, 8, 15, 25]
.
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!