Python prefix sum solution
py\n\n\'\'\'\nw: array, prefix sum\nh: this is a prefix-sum like problem, but we only\n    need to care about the last element in the list\n    so we only need 
```py\n\n\'\'\'\nw: array, prefix sum\nh: this is a prefix-sum like problem, but we only\n    need to care about the last element in the list\n    so we only need to store the last element\n    and compare to previous result\n    \nTime: O(N)\nspace: O(1)\n\n\'\'\'\nclass Solution:\n    def largestAltitude(self, gain: List[int]) -> int:\n        res = 0\n        start = 0\n        for i in gain:\n            start += i\n            res = max(res, start)\n            \n        return res\n    \n\'\'\'\nprefix-sum: a = [0, 1, 2, 3]\nwhat is the sum up to the current index in the array?\n\nres = [a[0]]\nfor i in a[1:]:\n    res.append(res[-1]+i)\n    \n\'\'\'\n```
['Prefix Sum', 'Python']