To find the maximum, track your "current best" as you scan the list.
Start by assuming the first element is the maximum. It's the only candidate you've seen so far.
Then compare each remaining element:
- If it's larger than your current max, update the max
- Otherwise, move on
After checking all elements, your tracked value is the answer.
Example with [3, 7, 2, 9, 1]:
Start: max = 3
See : , update max = 7
See : , keep max = 7
See : , update max = 9
See : , keep max = 9
Answer: