Feature #7: Maximum Users

Implement the "Maximum Number of Users" feature for our "Cellular Operator AT&T" project.

Description

On a busy intersection with heavy vehicular and pedestrian traffic, the operator deploys a base station. The number of users connected to that base station keeps changing rapidly, as people enter and leave its coverage area. The base station quickly dumps the current number of users to a list every 1 ms.

The operator wants to analyze the data to improve coverage for its users. However, the data contains rapid variations that don’t carry useful information from a network management perspective. To deal with the variation, the operator wants to find the maximum number of users connected to the base station in every k ms sliding window.

Given a list of values, we need to create a sliding window of size k (shown in red) and find the max in each sliding window. Different sliding windows in the given list are shown in separate rows in the following illustration, along with the maximum value in the sliding window.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.