Skip to content

Instantly share code, notes, and snippets.

@zhouzhuojie
Last active December 19, 2015 16:59
Show Gist options
  • Save zhouzhuojie/5987661 to your computer and use it in GitHub Desktop.
Save zhouzhuojie/5987661 to your computer and use it in GitHub Desktop.

Given a set of distinct integers, S, return all possible subsets.

Note:

  • Use list as data structure
  • Do NOT use itertools
  • Sort your final results to get standard output (Not considered as the time complexity). For example sorted(result).

For example, If S = [1,2], a solution is:

[
  [],
  [1],
  [1,2],
  [2]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment