Google VO Interview Coding Question: Average and Median Temperature in a Time Window

18 Views
No Comments

Input is a list of numbers representing the temperature of a city in the past few years. Please compute the average and median temperature given a time window.

This problem asks you to compute the average and median temperature over a given time window from a list of historical city temperatures. The key is to determine which readings belong to the window, then calculate the mean with a running sum and the median from the values inside the window, typically after sorting or maintaining an ordered data structure. For larger inputs, efficient sliding-window maintenance is the main challenge.

END
 0