
    Write a function that reorganizes n recent periods of hospital bed data, where negative values indicate available beds and positive values show bed demand, such that all available capacity entries appear before demand entries while maintaining their original chronological sequence within each category. The function should help hospital administrators quickly visualize the relationship between available capacity and demand patterns across departments for more effective resource allocation.
    

    
def re_arrange_array(arr, n):
    """
    Write a function that reorganizes n recent periods of hospital bed data, where negative values indicate available beds and positive values show bed demand, such that all available capacity entries appear before demand entries while maintaining their original chronological sequence within each category. The function should help hospital administrators quickly visualize the relationship between available capacity and demand patterns across departments for more effective resource allocation.
    

    """
def re_arrange_array(arr, n):
    """
    Write a function that reorganizes n recent periods of hospital bed data, where negative values indicate available beds and positive values show bed demand, such that all available capacity entries appear before demand entries while maintaining their original chronological sequence within each category. The function should help hospital administrators quickly visualize the relationship between available capacity and demand patterns across departments for more effective resource allocation.
    

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