Skip to content

Instantly share code, notes, and snippets.

@LarryKarani
Last active October 19, 2020 08:44
Show Gist options
  • Save LarryKarani/8c315badc3693b350fc79a676e8c71d2 to your computer and use it in GitHub Desktop.
Save LarryKarani/8c315badc3693b350fc79a676e8c71d2 to your computer and use it in GitHub Desktop.
#Witness of The Tall People
def witnesses(heights):
max_height = float('-inf')
total = 0
for i in range(len(heights) - 1, -1, -1):
if heights[i] > max_height:
total += 1
max_height = max(heights[i], max_height)
return total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment