You are given an array of distinct integers nums1 of length n.
You want to construct an array nums2 of length n. For each index i from n - 1, you can choose either:
nums2[i] = nums1[i]
nums2[i] = nums1[i] - nums1[j] for some index j such that
Return true if it is possible to create an array nums2 such that all its elements have the same parity (all even or all odd), and false otherwise.
Constraints:
n nums1.length
nums1[i]
nums1 consists of distinct integers.
You are given an array of distinct integers nums1 of length n.
You want to construct an array nums2 of length n. For each index i from n - 1, you can choose either:
nums2[i] = nums1[i]
nums2[i] = nums1[i] - nums1[j] for some index j such that
Return true if it is possible to create an array nums2 such that all its elements have the same parity (all even or all odd), and false otherwise.
Constraints:
n nums1.length
nums1[i]
nums1 consists of distinct integers.