首页 > 其他分享 >1732. 找到最高海拔

1732. 找到最高海拔

时间:2022-11-19 16:56:25浏览次数:86  
标签:找到 res 1732 high int 海拔 gain

1732. 找到最高海拔

class Solution {
    public int largestAltitude(int[] gain) {
        int res = 0;
        int high = 0;
        for(int i = 0; i < gain.length; i ++) {
            high += gain[i];
            res = Math.max(res, high);
        }
        return res;
    }
}

标签:找到,res,1732,high,int,海拔,gain
From: https://www.cnblogs.com/eiffelzero/p/16906435.html

相关文章