Last active
February 11, 2020 08:41
-
-
Save YDrall/f1bf6f15be54063f9d2ffdadbf19495b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = [1, 2, 3, 4] | |
from collections import deque | |
qu = deque([[a] for a in range(len(arr))]) | |
while qu: | |
q = qu.popleft() | |
print([arr[i] for i in q]) | |
for j in range(q[-1]+1, len(arr)): | |
qu.append(q + [j]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment