Skip to content

Commit 66de1d7

Browse files
add 1732
1 parent 1b779bf commit 66de1d7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1732|[Find the Highest Altitude](https://leetcode.com/problems/find-the-highest-altitude/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1732.java) ||Easy|Array|
1112
|1727|[Largest Submatrix With Rearrangements](https://leetcode.com/problems/largest-submatrix-with-rearrangements/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1727.java) ||Medium|Greedy, Sort|
1213
|1726|[Tuple with Same Product](https://leetcode.com/problems/tuple-with-same-product/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1726.java) ||Medium|Array|
1314
|1725|[Number Of Rectangles That Can Form The Largest Square](https://leetcode.com/problems/number-of-rectangles-that-can-form-the-largest-square/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1725.java) ||Easy|Greedy|
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1732 {
4+
public static class Solution1 {
5+
public int largestAltitude(int[] gain) {
6+
int max = 0;
7+
int[] altitudes = new int[gain.length + 1];
8+
for (int i = 0; i < gain.length; i++) {
9+
altitudes[i + 1] = altitudes[i] + gain[i];
10+
max = Math.max(max, altitudes[i + 1]);
11+
}
12+
return max;
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)