Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
from the nearest to the farthest solution in Clear category for Building Visibility by David_Jones
def checkio(buildings):
visible_buildings = 0
coverage_heights = [0] * 11
for x1, _, x2, _, height in sorted(buildings, key=lambda x: x[1]):
visible = False
for x in range(x1, x2):
if height > coverage_heights[x]:
visible = True
coverage_heights[x] = height
if visible:
visible_buildings += 1
return visible_buildings
June 13, 2019
Comments: