Whenever you're ready, walk me through how you'd approach this.
Find the optimal algorithm for computing max and average over consecutive groups of 1000s (for example, 1-1000, 2-1001, and so on).