EASIEST CPP SOLUTION
Intuition\nhere we have to find the max gain so we will just use the prefix sum technique.\n\n# Approach\ncreate an altitude pointer and a maxi pointer as soon 
# Intuition\nhere we have to find the max gain so we will just use the prefix sum technique.\n\n# Approach\ncreate an altitude pointer and a maxi pointer as soon as you get max gain update your maxi .\n\n# Complexity\n- Time complexity:\no(n) (only one loop )\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int altitude =0;\n        int maxi =0;\n        for( int i =0;i<gain.size();i++){\n           altitude=altitude+gain[i];\n            if( maxi < altitude)\n                maxi = altitude;\n            \n        }\n        return maxi;\n      \n    }\n};\n```
['C++']