1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-09-19 17:56:55 +02:00

cs: add “1732. Find the Highest Altitude”

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2024-01-08 22:26:17 +01:00
parent 30202920b0
commit ccd80cc46b
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -0,0 +1,13 @@
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;
}
}