[Kotlin] Solution
Approach\n Describe your approach to solving the problem. \nWell..\n\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Spa
# Approach\n<!-- Describe your approach to solving the problem. -->\nWell..\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n\n    fun largestAltitude(gain: IntArray): Int {\n        var currentAltitude = 0\n        var highestAltitude = 0\n\n        gain.forEach {\n            currentAltitude += it\n            highestAltitude = maxOf(highestAltitude, currentAltitude)\n        }\n\n        return highestAltitude\n    }\n}\n```
['Kotlin']