Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- heights = []
- for i in iter(input, "0"):
- heights.append(int(i))
- indexes = []
- for point in range(1, len(heights) - 1):
- if heights[point - 1] < heights[point] and heights[point] > heights[point + 1]:
- indexes.append(point)
- try:
- print(min(filter(lambda x : x > 0, (x-y for x in indexes for y in indexes))))
- except ValueError:
- print(0)
Advertisement
Add Comment
Please, Sign In to add comment