Josh Technology's test-data utilities need to group invalid measurements, represented by negative integers, before valid measurements. Rearrange the input array so that every negative number appears before every non-negative number, while preserving the relative order within both groups.
Modify the array in place and return it. The function must run in O(n) time. You may use O(n) auxiliary space for a stable linear-time solution.
nums, a mutable array of integers.< 0 precede all values >= 0.def arrange_negatives_first(nums):