
    Given a list of patient wait times where negative values indicate critical cases and positive values represent non-critical cases, develop a system to reorganize the most recent n patients in the emergency room queue such that all critical patients are prioritized before non-critical ones while maintaining the original order within each priority group.
    

    
def re_arrange_array(arr, n):
    """
    Given a list of patient wait times where negative values indicate critical cases and positive values represent non-critical cases, develop a system to reorganize the most recent n patients in the emergency room queue such that all critical patients are prioritized before non-critical ones while maintaining the original order within each priority group.
    

    """
def re_arrange_array(arr, n):
    """
    Given a list of patient wait times where negative values indicate critical cases and positive values represent non-critical cases, develop a system to reorganize the most recent n patients in the emergency room queue such that all critical patients are prioritized before non-critical ones while maintaining the original order within each priority group.
    

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