
    Given a list of user engagement scores between a target user and potential friend recommendations, find the highest compatibility score achievable by selecting a sequence of users where each subsequent user has a higher engagement score than the previous one and multiplying their respective scores together. This score will help identify the most optimal chain of friend recommendations to present to the target user.
    

    
def max_product(arr):
    """
    Given a list of user engagement scores between a target user and potential friend recommendations, find the highest compatibility score achievable by selecting a sequence of users where each subsequent user has a higher engagement score than the previous one and multiplying their respective scores together. This score will help identify the most optimal chain of friend recommendations to present to the target user.
    

    """
def max_product(arr):
    """
    Given a list of user engagement scores between a target user and potential friend recommendations, find the highest compatibility score achievable by selecting a sequence of users where each subsequent user has a higher engagement score than the previous one and multiplying their respective scores together. This score will help identify the most optimal chain of friend recommendations to present to the target user.
    

    """
    n = len(arr)
    mpis = arr[:]
    for i in range(n):
        current_prod = arr[i]
        j = i + 1
        while j < n:
            if arr[j - 1] > arr[j]:
                break
            current_prod *= arr[j]
            if current_prod > mpis[j]:
                mpis[j] = current_prod
            j = j + 1
    return max(mpis)