Tap here to switch tabs
Problem
Submissions

Problem: Sort Array By Parity

med
30 min
Try to solve the Sort Array By Parity problem.

Statement

Given an integer array nums, rearrange the elements such that all even integers appear before all odd integers.

Return any array that satisfies this condition.

Constraints:

  • 1≤1 \leq nums.length ≤5000\leq 5000

  • 0≤0 \leq nums[i] ≤5000\leq 5000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort Array By Parity

med
30 min
Try to solve the Sort Array By Parity problem.

Statement

Given an integer array nums, rearrange the elements such that all even integers appear before all odd integers.

Return any array that satisfies this condition.

Constraints:

  • 1≤1 \leq nums.length ≤5000\leq 5000

  • 0≤0 \leq nums[i] ≤5000\leq 5000