using System.Collections.Generic;
public static void findSubsets(List<List<int> > subset, List<int> nums, List<int> output, int index)
if (index == nums.Count) {
findSubsets(subset, nums, new List<int>(output), index + 1);
findSubsets(subset, nums, new List<int>(output), index + 1);
private static void permute(String str,
for (int i = l; i <= r; i++)
public static String swap(String a,
char[] charArray = a.ToCharArray();
charArray[i] = charArray[j];
string s = new string(charArray);
public static void Main()
List<List<int> > subset = new List<List<int> >();
List<int> input = new List<int>();
findSubsets(subset, input, new List<int>(), 0);
for (int i = 0; i < subset.Count; i++) {
for (int j = 0; j < subset[i].Count; j++) {
Console.Write(subset[i][j] + " ");