FunctionRacerProblemsRace

Sort by Parity

BeginnerArraysPython, JavaScript, TypeScript, Java, C++

Return a new list with all the even numbers of nums first, then all the odd numbers. Within the evens, and within the odds, keep the order they had in nums.

Example 1

nums [3,1,2,4]
returns [2,4,3,1]

Evens 2, 4 first, then odds 3, 1.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Arrays problems