Leetcode 1732. Find the Highest Altitude

2021-07-08 15:52:26 浏览数 (1)

文章作者:Tyan 博客:noahsnail.com | CSDN | 简书

1. Description

2. Solution

  • Version 1
代码语言:javascript复制
class Solution:
    def largestAltitude(self, gain: List[int]) -> int:
        highest = 0
        altitude = 0
        for x in gain:
            altitude  = x
            highest = max(highest, altitude)
        return highest

Reference

  1. https://leetcode.com/problems/find-the-highest-altitude/

0 人点赞