[ C++ ] [ Easy Solution ] [ Maximum Prefix Sum Value ]
Code\n\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int sum = 0;\n        int ans = 0;\n        for(int i = 0; i < gain.siz
# Code\n```\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int sum = 0;\n        int ans = 0;\n        for(int i = 0; i < gain.size(); i++) {\n            sum += gain[i];\n            ans = max(ans, sum);\n        }\n        return ans;\n    }\n};\n```
['C++']