Tap here to switch tabs
Problem
Submissions

Problem: Destroy Sequential Targets

med
30 min
Try to solve the Destroy Sequential Targets problem.

Statement

You are given an integer array nums representing target values and an integer space.

Choosing a seed value nums[i] allows you to destroy every target in nums that can be expressed as nums[i] + c * space, where c ≥0\geq 0 is any non negative integer.

Return the minimum value of nums[i] that destroys the maximum possible number of targets.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq space ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Destroy Sequential Targets

med
30 min
Try to solve the Destroy Sequential Targets problem.

Statement

You are given an integer array nums representing target values and an integer space.

Choosing a seed value nums[i] allows you to destroy every target in nums that can be expressed as nums[i] + c * space, where c ≥0\geq 0 is any non negative integer.

Return the minimum value of nums[i] that destroys the maximum possible number of targets.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq space ≤109\leq 10^9