LeetCode/cs/find-the-highest-altitude.cs
Matej Focko ccd80cc46b
cs: add “1732. Find the Highest Altitude”
Signed-off-by: Matej Focko <mfocko@redhat.com>
2024-01-08 22:26:17 +01:00

13 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;
}
}