Get Max Aggregate Temperature Change
Alexa is Amazon's virtual AI assistant. It makes it easy to set up your Alexa-enabled devices, listen to music, get weather updates, and much more. The team is working on a new feature that evaluates the aggregate temperature change for a period based on the changes in temperature of previous and upcoming days.
Taking the change in temperature data of n days, the aggregate temperature change evaluated on the ith day is the maximum of the sum of the changes in temperatures until the ith day, and the sum of the change in temperatures in the next (n - i) days, with the ith day temperature change included in both.
Given the temperature data of n days, find the maximum aggregate temperature change evaluated among all the days.
Complete the function getMaxAggregateTemperatureChange in the editor.
getMaxAggregateTemperatureChange has the following parameter:
int tempChange[n]: the temperature change data ofndays
Returns
long: the maximum aggregate temperature change
1Example 1

2Example 2
Constraints
Limits and guarantees your solution can rely on.
1 <= n <= 105-109 <= tempChange[i] <= 109 where, 1 <= i <= n