Feature #7: Highest Rank

Implementing the "Highest Rank" feature for our "Uber" project.


At Uber, each driver is assigned a rank based on the reviews they receive from their passengers. Currently, the system prioritizes drivers with the highest rank and assigns them instant rides. We want to change this driver selection criterion such that drivers with lower ranks don’t get starved while the drivers with high ranks keep getting rides. The drivers’ ranks are maintained in an unsorted list. We’ll call a hidden API that will provide us with a number k. The value of this k can range from 1 to the size of our rank list. Once we have a value k, we need to find the kth highest driver rank.

We’ll be provided with an unsorted list of integers representing the divers’ ranks. The drivers are represented by the index of this list. The value of k will be made available from the hidden API. Our task will be to determine the kth highest rank, so the driver associated with that rank can be selected.

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