mirror of
https://gitlab.com/mfocko/LeetCode.git
synced 2024-11-14 18:07:32 +01:00
14 lines
237 B
C#
14 lines
237 B
C#
|
public class Solution {
|
||
|
public int LargestAltitude(int[] gain) {
|
||
|
int m = 0;
|
||
|
int alt = 0;
|
||
|
|
||
|
foreach (var d in gain) {
|
||
|
alt += d;
|
||
|
m = Math.Max(m, alt);
|
||
|
}
|
||
|
|
||
|
return m;
|
||
|
}
|
||
|
}
|