Java solution mera bhi dekho
\nclass Solution {\n    public int largestAltitude(int[] gain) {\n        \n        int []result = new int[gain.length+1];\n        result[0]=0;\n        for(in
```\nclass Solution {\n    public int largestAltitude(int[] gain) {\n        \n        int []result = new int[gain.length+1];\n        result[0]=0;\n        for(int i=1;i<=gain.length;i++){\n            result[i]=result[i-1]+gain[i-1];\n        }\n        \n        int max = result[0];\n        for(int i=0;i<result.length;i++){\n            if(max<result[i]){\n                max = result[i];\n            }\n        }\n       return max; \n      \n    }\n}\n```
['Java']