← Back to List

25527번: Counting Peaks of Infection ↗

Solutions

Python 3
196 B | 196 chars
while 1:
  n = int(input())
  
  if n == 0:
    break
  
  l = [*map(int, input().split())]
  
  ans = 0
  for i in range(1, n - 1):
    if l[i - 1] < l[i] > l[i + 1]:
      ans += 1
  print(ans)