1732.cpp (208B)
1 class Solution { 2 public: 3 int largestAltitude(const vector<int> &gain) { 4 int maxi = 0, crnt = 0; 5 for (int n : gain) 6 maxi = max(maxi, crnt += n); 7 return maxi; 8 } 9 };