3876. Construct Uniform Parity Array II
You are given an array
nums1ofndistinct integers.You want to construct another array
nums2of lengthnsuch that the elements innums2are either all odd or all even.For each index
i, you must choose exactly one of the following (in any order):
nums2[i] = nums1[i]nums2[i] = nums1[i] - nums1[j], for an indexj != i, such thatnums1[i] - nums1[j] >= 1Return
trueif it is possible to construct such an array, otherwise returnfalse.
1 | class Solution { |