
    Given a fleet's delivery performance data containing both delayed and ahead-of-schedule travel times, reorganize the n most recent route records so that all delayed deliveries appear before the on-time ones while preserving their original chronological order within each category. The travel times are represented in minutes relative to schedule, where negative values indicate delays and positive values indicate early arrivals.
    

    
def re_arrange_array(arr, n):
    """
    Given a fleet's delivery performance data containing both delayed and ahead-of-schedule travel times, reorganize the n most recent route records so that all delayed deliveries appear before the on-time ones while preserving their original chronological order within each category. The travel times are represented in minutes relative to schedule, where negative values indicate delays and positive values indicate early arrivals.
    

    """
def re_arrange_array(arr, n):
    """
    Given a fleet's delivery performance data containing both delayed and ahead-of-schedule travel times, reorganize the n most recent route records so that all delayed deliveries appear before the on-time ones while preserving their original chronological order within each category. The travel times are represented in minutes relative to schedule, where negative values indicate delays and positive values indicate early arrivals.
    

    """
    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