given an integer array (of length n), find and return all the subsets of input array. code example
Example: find all subsets of an array javascript
const getAllSubsets =
theArray => theArray.reduce(
(subsets, value) => subsets.concat(
subsets.map(set => [value,...set])
),
[[]]
);
console.log(getAllSubsets([1,2,3]));