Your question is Reorder Array by Sign. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Veritas backup workflow uses signed integer priorities to classify work items. Reorder the given array so that every negative integer appears before every non-negative integer, while preserving the original relative order within both groups. Do not sort the values by magnitude.
Return a new array containing the same values. The input array may be modified, but modification is not required.
Implement stable_partition_priorities(nums), where nums is a list of integers. Return a list containing all values from nums in stable partition order:
The output must contain exactly the same number of occurrences of every value as the input.
def stable_partition_priorities(nums):