Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- a = [int(x) for x in input().split()]
- b = [2 for x in range(n)]
- for i in range(1, n - 1):
- if (a[i] < a[i - 1]) and (a[i] < a[i + 1]):
- b[i] = b[i - 1] + 1
- elif (a[i] > a[i - 1]) and (a[i] > a[i + 1]):
- b[i] = b[i - 1] + 1
- print(min(n, max(b)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement