
    Given a list of user similarity scores and a limit n, reorganize the first n user profiles so that all users with dissimilar interests (negative scores) appear before users with similar interests (positive scores), while maintaining the original relative ordering within each group to preserve recommendation accuracy.
    

    
def re_arrange_array(arr, n):
    """
    Given a list of user similarity scores and a limit n, reorganize the first n user profiles so that all users with dissimilar interests (negative scores) appear before users with similar interests (positive scores), while maintaining the original relative ordering within each group to preserve recommendation accuracy.
    

    """
def re_arrange_array(arr, n):
    """
    Given a list of user similarity scores and a limit n, reorganize the first n user profiles so that all users with dissimilar interests (negative scores) appear before users with similar interests (positive scores), while maintaining the original relative ordering within each group to preserve recommendation accuracy.
    

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