Solution in C
Code
# Code
```c []
int largestAltitude(int* gain, int gainSize) {
    int ans = 0, temp = 0;
    for (int i = 0; i < gainSize; i++) {
        temp += gain[i];
        if (temp >= ans)
            ans = temp;
    }
    return ans;
}
```
['C']