🏆C++ || EASY Prefix Sum
Code\n\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int max_altitude = 0;\n        int current = 0;\n        for(auto i:gai
# Code\n```\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int max_altitude = 0;\n        int current = 0;\n        for(auto i:gain){\n            current += i;\n            max_altitude = max(max_altitude,current);\n        }\n        return max_altitude;\n    }\n};\n```\n![upvote (2).jpg](https://assets.leetcode.com/users/images/b18dcb20-35e3-4a10-8974-4f3e9f2aa718_1687143452.991606.jpeg)\n
['C++']