Search⌘ K
AI Features

Sort Array By Parity II

Sort Array By Parity II rearranges an integer array with equal numbers of even and odd values so each even value is at an even index and each odd value at an odd index. Return any valid arrangement.

Statement

You are given an integer, array nums, where exactly half of the elements are even, and the other half are odd. ...