Easy C++/Python several different solutions
Intuition\n Describe your first thoughts on how to solve this problem. \ngain[i]=altitude[i+1]-altitude[i]\nFind max({altitude[i]})\n# Approach\n Describe your 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\ngain[i]=altitude[i+1]-altitude[i]\nFind max({altitude[i]})\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```C++ []\n\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int n=gain.size();\n        int hi=0, alt=0;\n        for(int i=0; i<n; i++){\n            alt+=gain[i];\n            hi=max(hi, alt);\n        }\n        return hi;\n    }\n};\n```\n```python []\nclass Solution:\n    def largestAltitude(self, gain: List[int]) -> int:\n        n=len(gain)\n        hi=0\n        alt=0\n        for x in gain:\n            alt+=x\n            hi=max(hi, alt)\n        return hi\n```\n# 2nd C++ uses STL vector & max_element\n```\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int n=gain.size();\n        vector<int> alt(n+1, 0);\n        alt[0]=0;\n        for(int i=1; i<=n; i++){\n            alt[i]=gain[i-1]+alt[i-1];\n            cout<<alt[i]<<",";\n        }\n        return *max_element(alt.begin(), alt.end());\n    }\n};\n```\n# 3rd C++ solution: No need for extra array alt[]\n```\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int n=gain.size();\n        for(int i=1; i<n; i++){\n            gain[i]+=gain[i-1];//No need for extra array\n        }\n        gain.push_back(0);//0 for the beginning\n        return *max_element(gain.begin(), gain.end());\n    }\n};\n```\n
['C++']