Skip to content

Instantly share code, notes, and snippets.

@NicolaM94
Created February 22, 2023 18:54
Show Gist options
  • Save NicolaM94/f85ccee682dfe6a61319fddba633a55a to your computer and use it in GitHub Desktop.
Save NicolaM94/f85ccee682dfe6a61319fddba633a55a to your computer and use it in GitHub Desktop.
Backward solution
def backwardSolution (buildings):
haveSight = [buildings[-1]]
for b in buildings[::-1]:
if b > haveSight[0]:
haveSight.insert(0,b)
return haveSight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment