Runtime: 0 ms, faster than 100.00% of Java online submissions
\n/** 1732. Find the Highest Altitude **/\n\nclass Solution {\n    public int largestAltitude(int[] gain) {\n        int n = gain.length;\n  \n        int max =
```\n/** 1732. Find the Highest Altitude **/\n\nclass Solution {\n    public int largestAltitude(int[] gain) {\n        int n = gain.length;\n  \n        int max = Integer.MIN_VALUE;\n        int ans  = 0;\n        int[] arr = new int[n+1];\n        arr[0]=0;\n        for(int i = 1; i<n+1; i++){\n            arr[i]=gain[i-1];\n        }\n        \n        for(int i = 0; i< n+1; i++){\n            \n            ans += arr[i];\n            if(ans>max){\n                max = ans;\n            }\n        }\n        return max;\n    }\n}\n\n```\n
['Array', 'Prefix Sum', 'Java']