[C++] PSA + Sorting (Beats 100%!)
ApproachStandard PSA approach, then finding the maximum element in the array.Code
# Approach\nStandard PSA approach, then finding the maximum element in the array.\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int psa[103];\n    int largestAltitude(vector<int>& gain) {\n        for (int i = 1; i <= gain.size(); ++i)\n            psa[i] = psa[i-1]+gain[i-1];\n        return *max_element(psa, psa+103);\n    }\n};\n```
['Sorting', 'Prefix Sum', 'C++']