Practice Destroy Sequential Targets
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed array nums consisting of positive integers, representing targets on a number line. You are also given an integer space. You have a machine which can destroy targets. Seeding the machine with some nums[i] allows it to destroy all targets with values that can be represented as nums[i] + c * space, where c is any non-negative integer. You want to destroy the maximum number of targets in nums. Return the minimum value of nums[i] you can seed the machine with to destroy the maximum number of targets.
Source: Destroy Sequential Targets on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [3,7,8,1,1,5], space = 2
1
# Example 2
nums = [1,3,5,2,4,6], space = 2
1
# Example 3
nums = [6,2,5], space = 100
2
Constraints
Related LeetCode Problems
Practice more problems similar to Destroy Sequential Targets.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.