#3467

Transform Array by Parity

easy · 89.7% accepted · 102 likes · top 99%

array · sorting · counting

⊣ practice⊣ open on leetcode ↗

Description

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

- Replace each even number with 0.

- Replace each odd numbers with 1.

- Sort the modified array in non-decreasing order.

Return the resulting array after performing these operations.

Solution