Lesson 1 of 7
Live algorithm trace
Running maximum
Complete execution1 of 5
Initialize best from the first value, so negative-only inputs also work.
1
best = nums[0]2
for each x in nums3
if x > best: best = x4
return bestbest = 7
Welcome to the Dune Sea. An array is a row of boxes sitting side-by-side in memory. Each box holds one value.