Skip to content

Commit 6a34731

Browse files
Leetcode accepted
1 parent fd77d3c commit 6a34731

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Buildings With an Ocean View.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Buildings With an Ocean View
2+
# https://leetcode.com/problems/buildings-with-an-ocean-view/
3+
4+
class Solution(object):
5+
def findBuildings(self, heights):
6+
indices = []
7+
maxHeightToRight = 0
8+
for i in range(len(heights)-1, -1, -1):
9+
if (heights[i] > maxHeightToRight):
10+
indices.append(i)
11+
maxHeightToRight = heights[i]
12+
indices.reverse()
13+
return indices
14+
"""
15+
:type heights: List[int]
16+
:rtype: List[int]
17+
"""
18+

0 commit comments

Comments
 (0)