✅Easy Java solution||Beginner Friendly🔥
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# Co
# 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    public int largestAltitude(int[] gain) {\n        int count = 0;\n        int max = 0;\n        int currSum = 0;\n        for(int i = 0; i < gain.length; i ++){\n            currSum += gain[i];\n            if(currSum > max){\n                max = currSum;\n            }\n        }\n        return max;\n    }\n}\n```\n**If you really found my solution helpful please upvote it, as it motivates me to post such kind of codes and help the coding community, if you have some queries or some improvements please feel free to comment and share your views.\nHappy Coding**
['Array', 'Prefix Sum', 'Java']