Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def findBuildings(self, heights: List[int]) -> List[int]:
- last = len(heights) - 1
- heights.append(-1)
- result = [-1]
- while last >= 0:
- if heights[last] > heights[result[-1]]:
- result.append(last)
- last -= 1
- return result[::-1][:-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement