Tap here to switch tabs
Problem
Submissions

Problem: Find the Highest Altitude

med
30 min
Try to solve the Find the Highest Altitude problem.

Statement

You are given an integer array gain where gain[i] represents the net change in altitude after traveling from point i to point i + 1. The altitude at the starting point is 00.

Compute and return the highest altitude reached at any point during the trip, including the starting point.

Constraints:

  • n == gain.length

  • 1≤‘n‘≤1001 \leq `n` \leq 100

  • −100≤‘gain[i]‘≤100-100 \leq `gain[i]` \leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Highest Altitude

med
30 min
Try to solve the Find the Highest Altitude problem.

Statement

You are given an integer array gain where gain[i] represents the net change in altitude after traveling from point i to point i + 1. The altitude at the starting point is 00.

Compute and return the highest altitude reached at any point during the trip, including the starting point.

Constraints:

  • n == gain.length

  • 1≤‘n‘≤1001 \leq `n` \leq 100

  • −100≤‘gain[i]‘≤100-100 \leq `gain[i]` \leq 100