easyArrayCountingSorting 0 views

Transform Array by Parity

You are given an integer array nums.

You are given an integer array nums. Transform nums by performing the following operations in the exact order specified:

Return the resulting array after performing these operations.

Transform Array by Parity diagram

Example 1

Input: nums = [4,3,2,1]

Output: [0,0,1,1]

Example 2

Input: nums = [1,5,1,4,2]

Output: [0,0,1,1,1]

Constraints

  • 1 <= nums.length <= 100
  • 1 <= nums[i] <= 1000

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.