[C++] Easy to understand one pass solution (100% time and 100% space)
\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int result = 0;\n        int count = 0;\n        \n        for (int s : gain)
```\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int result = 0;\n        int count = 0;\n        \n        for (int s : gain) {\n            count += s;\n            result = max(result, count);\n        }\n        \n        return result;\n    }\n};\n```
[]