
    Given a sequence of financial transactions where negative values represent withdrawals and positive values represent deposits, develop a function that reorganizes the most recent n transactions so that all withdrawals appear before deposits while maintaining their original chronological order within each category. This reorganization is needed to efficiently analyze withdrawal patterns separately from deposit patterns in the bank's real-time fraud detection system.
    

    
def re_arrange_array(arr, n):
    """
    Given a sequence of financial transactions where negative values represent withdrawals and positive values represent deposits, develop a function that reorganizes the most recent n transactions so that all withdrawals appear before deposits while maintaining their original chronological order within each category. This reorganization is needed to efficiently analyze withdrawal patterns separately from deposit patterns in the bank's real-time fraud detection system.
    

    """
def re_arrange_array(arr, n):
    """
    Given a sequence of financial transactions where negative values represent withdrawals and positive values represent deposits, develop a function that reorganizes the most recent n transactions so that all withdrawals appear before deposits while maintaining their original chronological order within each category. This reorganization is needed to efficiently analyze withdrawal patterns separately from deposit patterns in the bank's real-time fraud detection system.
    

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