Tap here to switch tabs
Problem
Submissions

Problem: Prime Subtraction Operation

med
30 min
Try to solve the Prime Subtraction Operation problem.

Statement

You are given a 00 indexed integer array nums of length n.

You can perform the following operation any number of times:

  • Select an index i that has not been chosen previously.

  • Choose a prime number p that is strictly less than nums[i].

  • Subtract p from nums[i].

Return true if you can make nums strictly increasing after applying the operations, or false otherwise.

Note: An array is considered strictly increasing if nums[i - 1] << nums[i] for all 1≤1 \leq i << n.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000

  • nums.length ==== n

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Prime Subtraction Operation

med
30 min
Try to solve the Prime Subtraction Operation problem.

Statement

You are given a 00 indexed integer array nums of length n.

You can perform the following operation any number of times:

  • Select an index i that has not been chosen previously.

  • Choose a prime number p that is strictly less than nums[i].

  • Subtract p from nums[i].

Return true if you can make nums strictly increasing after applying the operations, or false otherwise.

Note: An array is considered strictly increasing if nums[i - 1] << nums[i] for all 1≤1 \leq i << n.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000

  • nums.length ==== n