Subsets II

Medium · Backtracking · about 15 minutes

Asked at Bloomberg, Microsoft, Amazon, Meta, Google.

nums may repeat values. List every distinct collection you can form by choosing some of its elements (from none to all), counting two collections as the same when they hold the same values. Collections, and the values inside each, may be listed in any order.

Related guides