
    In a loan approval system, create a function that processes n most recent credit history factors and reorganizes them so that all risk indicators (negative values) appear before positive credit factors while maintaining their chronological sequence within each category. The function should take an array of credit score factors where negative values represent risks and positive values represent favorable indicators, along with an integer n specifying how many recent factors to consider.
    

    
def re_arrange_array(arr, n):
    """
    In a loan approval system, create a function that processes n most recent credit history factors and reorganizes them so that all risk indicators (negative values) appear before positive credit factors while maintaining their chronological sequence within each category. The function should take an array of credit score factors where negative values represent risks and positive values represent favorable indicators, along with an integer n specifying how many recent factors to consider.
    

    """
def re_arrange_array(arr, n):
    """
    In a loan approval system, create a function that processes n most recent credit history factors and reorganizes them so that all risk indicators (negative values) appear before positive credit factors while maintaining their chronological sequence within each category. The function should take an array of credit score factors where negative values represent risks and positive values represent favorable indicators, along with an integer n specifying how many recent factors to consider.
    

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