
    Write a function that analyzes a customer's financial indicators by rearranging the n most recent transactions so that all unfavorable factors (negative values) appear before favorable ones (positive values) while maintaining their chronological sequence within each category. The reorganized sequence will help prioritize risk factors in credit score calculations while preserving the temporal relationship of similar-type indicators.
    

    
def re_arrange_array(arr, n):
    """
    Write a function that analyzes a customer's financial indicators by rearranging the n most recent transactions so that all unfavorable factors (negative values) appear before favorable ones (positive values) while maintaining their chronological sequence within each category. The reorganized sequence will help prioritize risk factors in credit score calculations while preserving the temporal relationship of similar-type indicators.
    

    """
def re_arrange_array(arr, n):
    """
    Write a function that analyzes a customer's financial indicators by rearranging the n most recent transactions so that all unfavorable factors (negative values) appear before favorable ones (positive values) while maintaining their chronological sequence within each category. The reorganized sequence will help prioritize risk factors in credit score calculations while preserving the temporal relationship of similar-type indicators.
    

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