
    Given a sequence of user engagement scores for different events in a social network, where positive scores indicate interest and negative scores show disinterest, find the consecutive series of events that would generate maximum collective appeal when recommended together to a group of connected users. The collective appeal is calculated as the product of individual engagement scores, and your task is to identify the subsequence that yields the highest product value.
    

    
def max_subarray_product(arr):
    """
    Given a sequence of user engagement scores for different events in a social network, where positive scores indicate interest and negative scores show disinterest, find the consecutive series of events that would generate maximum collective appeal when recommended together to a group of connected users. The collective appeal is calculated as the product of individual engagement scores, and your task is to identify the subsequence that yields the highest product value.
    

    """
def max_subarray_product(arr):
    """
    Given a sequence of user engagement scores for different events in a social network, where positive scores indicate interest and negative scores show disinterest, find the consecutive series of events that would generate maximum collective appeal when recommended together to a group of connected users. The collective appeal is calculated as the product of individual engagement scores, and your task is to identify the subsequence that yields the highest product value.
    

    """
    n = len(arr)
    max_ending_here = 1
    min_ending_here = 1
    max_so_far = 0
    flag = 0
    for i in range(0, n):
        if arr[i] > 0:
            max_ending_here = max_ending_here * arr[i]
            min_ending_here = min(min_ending_here * arr[i], 1)
            flag = 1
        elif arr[i] == 0:
            max_ending_here = 1
            min_ending_here = 1
        else:
            temp = max_ending_here
            max_ending_here = max(min_ending_here * arr[i], 1)
            min_ending_here = temp * arr[i]
        if max_so_far < max_ending_here:
            max_so_far = max_ending_here
    if flag == 0 and max_so_far == 0:
        return 0
    return max_so_far