
    Given historical emergency room wait time variations across different periods, where negative values indicate faster-than-expected processing and positive values indicate delays, reorganize the most recent n time periods so that all periods with reduced wait times appear before periods with delays while maintaining their chronological sequence within each category. This reorganization will help hospital administrators identify patterns in patient processing efficiency while preserving the temporal relationship between similar performance periods.
    

    
def re_arrange_array(arr, n):
    """
    Given historical emergency room wait time variations across different periods, where negative values indicate faster-than-expected processing and positive values indicate delays, reorganize the most recent n time periods so that all periods with reduced wait times appear before periods with delays while maintaining their chronological sequence within each category. This reorganization will help hospital administrators identify patterns in patient processing efficiency while preserving the temporal relationship between similar performance periods.
    

    """
def re_arrange_array(arr, n):
    """
    Given historical emergency room wait time variations across different periods, where negative values indicate faster-than-expected processing and positive values indicate delays, reorganize the most recent n time periods so that all periods with reduced wait times appear before periods with delays while maintaining their chronological sequence within each category. This reorganization will help hospital administrators identify patterns in patient processing efficiency while preserving the temporal relationship between similar performance periods.
    

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