Python Elegant & Short | One-Line | Prefix Sum
Complexity\n- Time complexity: O(n)\n- Space complexity: O(1)\n\n# Code\n\nclass Solution:\n    def largestAltitude(self, gain: List[int]) -> int:\n        retu
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution:\n    def largestAltitude(self, gain: List[int]) -> int:\n        return max(accumulate(gain, initial=0))\n```
['Prefix Sum', 'Python', 'Python3']