Find the highest altitude using prefix sum approach
\n# Code\nC++ []\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int n = gain.size();\n        int sum = 0;\n        int highe
\n# Code\n```C++ []\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int n = gain.size();\n        int sum = 0;\n        int highest = 0;\n        for(int i=0;i<n;i++) {\n            sum += gain[i];\n            highest = max(highest, sum);\n        }\n        return highest;\n    }\n};\n```\n```Python3 []\nclass Solution:\n    def largestAltitude(self, gain: List[int]) -> int:\n        highest = 0\n        currHeight = 0\n        for i in range(len(gain)):\n            currHeight += gain[i]\n            highest = max(highest, currHeight)\n        return highest\n```
['Array', 'Prefix Sum', 'C++', 'Python3']