Compute Rolling Averages and Merge Intervals | WeRide Interview Question