24ms, Python (with comments)
If you found this post helpfull, please Upvote :)\n\nclass Solution(object):\n    def largestAltitude(self, gain):\n        """\n        :type gain: List[int]\n
If you found this post helpfull, please **Upvote** :)\n```\nclass Solution(object):\n    def largestAltitude(self, gain):\n        """\n        :type gain: List[int]\n        :rtype: int\n        """\n\t\t#initialize a variable to store the end output\n        result = 0\n\t\t#initialize a variable to keep track of the altitude at each iteration\n        current_altitude=0\n\t\t#looping through each of the gains\n        for g in gain:\n\t\t#updating the current altitude based on the gain\n            current_altitude += g\n\t\t\t#if the current altitude is greater than the highest altitude recorded then assign it as the result. This done iteratively, allows us to find the highest altitude\n            if current_altitude > result:\n                result = current_altitude\n        return result\n```\n![image](https://assets.leetcode.com/users/images/f7dd9ca2-d957-4b03-96e9-fb18c23cdb60_1621685013.6429558.png)\n\nPlease comment if you have any doubts or suggestions :)
['Python', 'Python3']