Skip to content

Instantly share code, notes, and snippets.

@Kush1101
Created June 1, 2021 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kush1101/0903d9a532aa2ccacdcaf6be7320a1ba to your computer and use it in GitHub Desktop.
Save Kush1101/0903d9a532aa2ccacdcaf6be7320a1ba to your computer and use it in GitHub Desktop.
def prefix_of_list(array):
ans = [[]]
prev = ans[-1]
for i in range(len(array)):
ans.append(prev + array[i])
return ans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment