def longestPeak(arr):
    i = 0
    max_peak_length = 0
    while i < len(arr) - 2:
        j = i
        while arr[j + 1] > arr[j] and j < len(arr):
            j += 1
        if j > i:
            k = j
            while arr[k + 1] < arr[k] and k < len(arr):
                k += 1
            if k > j:
                max_peak_length = max(k - i + 1, max_peak_length)
        i = j + 1

    return max_peak_length

arr = [1, 2, 3, 3, 4, 0, 10, 6, 5, -1, -3, 2, 3]
print(longestPeak(arr))

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: