Last active
October 19, 2020 08:44
-
-
Save LarryKarani/8c315badc3693b350fc79a676e8c71d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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