❤️C++ Easy Solution || Leet code solution
\n Describe your first thoughts on how to solve this problem. \n\n# Approach : Prefix SUM\n Describe your approach to solving the problem. \n\n# Complexity\n- T
\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach : Prefix SUM\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n# **Please UpVote if u like**\n\n# Code\n```\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int alt=0;\n        int ans=0;\n        for(auto x:gain)\n        {\n            alt+=x;\n            ans=max(ans,alt);\n        }\n        return ans;\n    }\n};\n```\n# **Please UpVote if u like**
['C++']