leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
1732.cpp (208B)
0 class Solution {
1 public:
2 int largestAltitude(const vector<int> &gain) {
3 int maxi = 0, crnt = 0;
4 for (int n : gain)
5 maxi = max(maxi, crnt += n);
6 return maxi;
7 }
8 };