Partition a list in-place so that all negative numbers appear before non-negative numbers.
Constraints
Example
>>> nums = [1, -2, 3, -4, 5] >>> rearrange_pos_neg(nums) >>> nums [-2, -4, 3, 1, 5] # any order with negatives first is accepted >>> nums = [] >>> rearrange_pos_neg(nums) >>> nums [] >>> nums = [-1, 0, 2] >>> rearrange_pos_neg(nums) >>> nums [-1, 0, 2]
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints