2023年7月30日 星期日

[1732] Find the Highest Altitude

感覺是個歡樂的題目?!
秒殺~easy easy XD
int largestAltitude(int* gain, int gainSize){
int max = 0;
int now=0;
for (int i=0;i<gainSize; i++)
{
now+=gain[i];
if (now > max)
max = now;
}
return max;
}

沒有留言:

張貼留言