#3281

Maximize Score of Numbers in Ranges

medium · 35.6% accepted · 223 likes · top 13%

array · binary search · greedy · sorting

⊣ practice⊣ open on leetcode ↗

Description

You are given an array of integers start and an integer d, representing n intervals [start[i], start[i] + d].

You are asked to choose n integers where the ith integer must belong to the ith interval. The score of the chosen integers is defined as the minimum absolute difference between any two integers that have been chosen.

Return the maximum possible score of the chosen integers.

Solution