Skip to content

Practice Prime Subtraction Operation

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2601
LeetCode Problem

Prime Subtraction Operation

Problem Statement

For any chosen index i, you may once subtract a prime p strictly smaller than nums[i]. Each index may be used at most once, and you may leave indices unchanged. Return whether these operations can make nums strictly increasing.

Source: Prime Subtraction Operation on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [4,9,6,10]
Output
true

# Example 2

Input
nums = [6,8,11,12]
Output
true

# Example 3

Input
nums = [5,8,3]
Output
false

Constraints

1 <= nums.length <= 1000
1 <= nums[i] <= 1000
nums.length == n

Related LeetCode Problems

Practice more problems similar to Prime Subtraction Operation.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.