Simplified problem: track the maximum value(s) seen so far while scanning an array.
Asked in the phone screen stage. This was the first of two coding-style questions on the Meta embedded phone screen.
Implement track_maxima(nums) to return an array where position i contains the largest value in nums[0:i+1].
Input is a nonempty array of integers. Return an array of integers with the same length.
def track_maxima(nums):