Feature #12: Peak Signal Strength

Description

On an expressway, our network provider has deployed wireless access points to provide Internet access. On the same expressway, an advertisement company wants to deploy a smart advertisement board that displays and updates the ads according to the changing trends. The smart device needs Internet access, and the advertisement company has signed a contract with our network provider for its smart device. The advertisement company wants to ensure that their smart device has satisfactory signal strength available to operate properly.

With multiple wireless access points deployed on the expressway, the received signal strength varies as we move across it. As we move towards an access point, the received signal strength increases until it reaches a peak value. As we start moving away from the access point, and the received signal strength drops. This continues until we are between two consecutive access points. At this point, the device associates with the next access point, and the received signal strength starts to increase as we move closer to the other access point.

The signal strength values are recorded in an array for each position on the expressway. The first element in the array represents the signal strength at one end of the expressway, and each subsequent element is recorded further away from that end.

Given such an input array containing the signal strengths, our task is to identify and deploy the smart device on any position on the expressway where a maximal signal is recorded from any access points. A value is maximal if it is greater than both of its neighboring values.

Note that the global maximum is not of interest because that access point may be congested with too many users and might not offer an optimal data rate.

Let’s review a few examples below:

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