
    Given a fleet monitoring system tracking delivery trucks' schedule deviations (in minutes), develop a function that reorganizes the first n actively monitored trucks so that all delayed trucks (negative time deviations) are prioritized before on-time trucks (positive time deviations), while maintaining the original sequence within each category. The function should process only the n trucks currently under active monitoring for immediate route optimization, leaving the remaining fleet data unchanged.
    

    
def re_arrange_array(arr, n):
    """
    Given a fleet monitoring system tracking delivery trucks' schedule deviations (in minutes), develop a function that reorganizes the first n actively monitored trucks so that all delayed trucks (negative time deviations) are prioritized before on-time trucks (positive time deviations), while maintaining the original sequence within each category. The function should process only the n trucks currently under active monitoring for immediate route optimization, leaving the remaining fleet data unchanged.
    

    """
def re_arrange_array(arr, n):
    """
    Given a fleet monitoring system tracking delivery trucks' schedule deviations (in minutes), develop a function that reorganizes the first n actively monitored trucks so that all delayed trucks (negative time deviations) are prioritized before on-time trucks (positive time deviations), while maintaining the original sequence within each category. The function should process only the n trucks currently under active monitoring for immediate route optimization, leaving the remaining fleet data unchanged.
    

    """
    j = 0
    for i in range(0, n):
        if arr[i] < 0:
            temp = arr[i]
            arr[i] = arr[j]
            arr[j] = temp
            j = j + 1
    return arr