0 ms RunTime, Naive Approach
Do hit Upvote if you like the solution.\n\n# Code\n\nclass Solution {\n    public int largestAltitude(int[] gain) {\n        int len = gain.length;\n        int
Do hit Upvote if you like the solution.\n\n# Code\n```\nclass Solution {\n    public int largestAltitude(int[] gain) {\n        int len = gain.length;\n        int[] res = new int[len+1]; \n        int sum = 0;\n        int a = Integer.MIN_VALUE;\n        res[0] = 0;\n        for (int i = 1; i < len+1; i++) {\n            sum += gain[i-1];\n            res[i] = sum;\n        }\n        for (int i = 0; i < res.length; i++) {\n            if(a < res[i]) {\n                a = res[i];\n            }\n        }\n        return a;\n    }\n}\n```
['Java']