<s>[INST] Given an array of integers, move all negative numbers before all positive numbers maintaining their relative order.

Example: [0, 1, -3, -2, 2] → [-3, -2, 0, 1, 2]
Input: nums = [2, 1, -4, 7, -6, 10]
Output: [-4, -6, 2, 1, 7, 10]

Here's a quick solution using some Python code:

```python
def rearrange(nums):
    # Separate negative and non-negative numbers
    negatives = [x for x in nums if x < 0]
    non_negatives = [x for x in nums if x >= 0]

    # Combine them, negatives first
    return negatives + non_negatives
```

Now we want to modify this code to handle one more constraint:

**Constraint:** All positive numbers must be moved next to each other (i.e., no zeros in between the positive numbers), and similarly, all non-negative numbers must be moved next to each other (i.e., no negative numbers in between the positive or zero numbers).

**Example:** [1, 0, -2, 3, -4, 5, 0] → [-2, -4, 0, 0, 1, 3, 5]

Here's an updated solution in Python that incorporates the new constraint:

```python
def rearrange(nums):
    # Define helper function to place all zeros in one go
    def place_zeros(arr):
        zero_count = arr.count(0)
        arr = [x for x in arr if x != 0]
        return [x for x in arr] + [0] * zero_count

    # Separate negative, zero, and positive numbers
    negatives = sorted([x for x in nums if x < 0])
    zeros = nums.count(0)
    positives = sorted([x for x in nums if x > 0])

    # Combine negatives, zeros, and positives, in order
    return place_zeros(negatives + positives)
```

Do the above two Python functions run in O(n) time complexity or is it O(n log n)?[/INST]