Get Max Aggregate Temperature Change
Problem Overview
- Find the maximum aggregate temperature change across n days.
- For each day i, compare the sum of changes up to i and the sum from i to n (i included), then take the overall maximum.
- Input: int array tempChange[n]; Output: long maximum aggregate value.
- Constraints: 1 ≤ n ≤ 1e5; tempChange[i] ∈ [-1e9, 1e9].
- Real-world: Alexa temperature trend evaluation; asked in Amazon interviews as a coding interview problem and interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
