JAVA || C++ || PYTHON || SELF EXPLANATORY
CPP\n\nRuntime: 0 ms, faster than 100.00% of C++ online submissions\nMemory Usage: 8 MB, less than 100.00% of C++ online submissions\n\nclass Solution {\npublic
# **CPP**\n\n**Runtime: 0 ms, faster than 100.00% of C++ online submissions\nMemory Usage: 8 MB, less than 100.00% of C++ online submissions**\n```\nclass Solution {\npublic:\n    int largestAltitude(vector<int>& gain) {\n        int max_alt=0;\n        int curr_alt=0;\n        for(int i=0;i<gain.size();i++){\n            curr_alt+=gain[i]; \n            max_alt=max(curr_alt, max_alt);\n        }\n        return max_alt;\n    }\n};\n\n//TC: O(n), SC: O(1)\n```\n\n# **JAVA**\n\n**Runtime: 0 ms, faster than 100.00% of Java online submissions\nMemory Usage: 36.4 MB, less than 100.00% of Java online submissions**\n```\nclass Solution {\n    public int largestAltitude(int[] gain) {\n         int max_alt=0;\n        int curr_alt=0;\n        for(int i=0;i<gain.length;i++){\n            curr_alt+=gain[i]; \n            max_alt=Math.max(curr_alt, max_alt);\n        }\n        return max_alt;\n    }\n}\n\n//TC: O(n), SC: O(1)\n```\n\n# **PYTHON**\n**Runtime: 32 ms, faster than 100.00% of Python3 online submissions\nMemory Usage: 14.2 MB, less than 100.00% of Python3 online submissions**\n\n```\nclass Solution:\n    def largestAltitude(self, gain: List[int]) -> int:\n        curr_alt=0\n        max_alt=0\n        for i in range(0,len(gain)):\n            curr_alt+=gain[i]\n            max_alt=max(max_alt,curr_alt)\n        return max_alt\n\t\t\n//TC: O(n), SC: O(1)\t\t\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['C', 'C++', 'Java', 'Python3']