Tap here to switch tabs
Problem
Submissions

Problem: Maximize Score of Numbers in Ranges

med
30 min
Try to solve the Maximize Score of Numbers in Ranges problem.

Statement

You are given an array of integers start and an integer d.

There are start.length intervals, where the ith interval is defined as [[start[i], start[i] ++ d]].

You must choose a single integer from each interval. The score of the chosen integers is defined as the minimum absolute difference between any two chosen integers.

Return the maximum possible score that can be achieved.

Constraints:

  • 2≤2 \leq start.length ≤105\leq 10^5

  • 0≤0 \leq start[i] ≤109\leq 10^9

  • 0≤0 \leq d ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximize Score of Numbers in Ranges

med
30 min
Try to solve the Maximize Score of Numbers in Ranges problem.

Statement

You are given an array of integers start and an integer d.

There are start.length intervals, where the ith interval is defined as [[start[i], start[i] ++ d]].

You must choose a single integer from each interval. The score of the chosen integers is defined as the minimum absolute difference between any two chosen integers.

Return the maximum possible score that can be achieved.

Constraints:

  • 2≤2 \leq start.length ≤105\leq 10^5

  • 0≤0 \leq start[i] ≤109\leq 10^9

  • 0≤0 \leq d ≤109\leq 10^9