Stable Odd-First Partition
Problem statement
Return a new array containing every odd value from nums first, followed by every even value. Preserve the relative order within both groups.
Negative integers use ordinary divisibility by 2; for example -3 is odd.
Function
stableOddFirst(nums: int[]) → int[]Examples
Example 1
nums = [2,3,4,1,6,5]return = [3,1,5,2,4,6]Both the odd and even subsequences retain their input order.
Constraints
0 <= nums.length <= 10^5.