
    Develop a fraud detection function that analyzes the n most recent credit card transactions and reorganizes them to group all declined/flagged transactions before approved ones, while maintaining their chronological sequence within each group. The function should process a transaction history array where negative values represent declined/flagged transactions and positive values represent approved transactions, helping analysts quickly identify patterns of suspicious activity in the specified time window.
    

    
def re_arrange_array(arr, n):
    """
    Develop a fraud detection function that analyzes the n most recent credit card transactions and reorganizes them to group all declined/flagged transactions before approved ones, while maintaining their chronological sequence within each group. The function should process a transaction history array where negative values represent declined/flagged transactions and positive values represent approved transactions, helping analysts quickly identify patterns of suspicious activity in the specified time window.
    

    """
def re_arrange_array(arr, n):
    """
    Develop a fraud detection function that analyzes the n most recent credit card transactions and reorganizes them to group all declined/flagged transactions before approved ones, while maintaining their chronological sequence within each group. The function should process a transaction history array where negative values represent declined/flagged transactions and positive values represent approved transactions, helping analysts quickly identify patterns of suspicious activity in the specified time window.
    

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