← 返回 snapchat 的题目列表Time-Windowed Metric Aggregator with Average Query
类型:online_judge
snapchat
Design a metric aggregator system that can receive a large number of data points and aggregate data based on a time window.
Requirements:
Implement the interface addPoint(int timestamp, int value) to add a data point.
Implement the interface getAverage(int startTime, int endTime) to get the average of all points within the given time window.
Note:
Timestamps are given in order but may have data points with the same timestamp.