Binary battle question chef and restaurant

Can anyone explain me the solution of this question Chef and Restaurant??

Sort your input array. Then calculate the number of hotels that can be established between two cities. Keep adding this to your answer. Make sure that you don’t establish a hotel after distance d.

1 Like

Thanks for your suggestion…