Subsets
Medium · Backtracking · about 15 minutes
Asked at Amazon, Meta, Google, Microsoft, Bloomberg, ByteDance.
nums holds distinct values. List every collection you can form from them, from the empty one up to the whole array. Any order is accepted, both for the collections and for the values inside each.