How would you get all possible combinations of an array of numerical values similar to python itertools without using itertools npm package in this same order?
This is a python implementation.
from itertools import combinations
input = [0,1,2,3]
output = sum([list(map(list, combinations(input, i))) for i in range(len(input) + 1)], [])
>>> output
[[],
[0],
[1],
[2],
[3],
[0, 1],
[0, 2],
[0, 3],
[1, 2],
[1, 3],
[2, 3],
[0, 1, 2],
[0, 1, 3],
[0, 2, 3],
[1, 2, 3],
[0, 1, 2, 3]]