Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Highest Building by book1978
def highest_building(buildings):
for p, i in enumerate(buildings):
if 1 in i:
return [i.index(1) + 1, len(buildings) - p]
print("Example:")
print(highest_building([[0, 0, 1, 0], [1, 0, 1, 0], [1, 1, 1, 0], [1, 1, 1, 1]]))
# These "asserts" are used for self-checking
assert highest_building([[0, 0, 1, 0], [1, 0, 1, 0], [1, 1, 1, 0], [1, 1, 1, 1]]) == [
3,
4,
]
assert highest_building([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) == [
4,
1,
]
print("The mission is done! Click 'Check Solution' to earn rewards!")
Oct. 15, 2024
Comments: