Skip to content

Instantly share code, notes, and snippets.

Created June 1, 2021 05:28
What would you like to do?
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