
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Think about if we have many primes to subtract from nums[i]. Which prime is more optimal?
The most optimal prime to subtract from nums[i] is the one that makes nums[i] the smallest as possible and greater than nums[i-1].