Printing all possible subsets of a list

后端 未结 7 1378
半阙折子戏
半阙折子戏 2020-12-28 11:18

I have a List of elements (1, 2, 3), and I need to get the superset (powerset) of that list (without repeating elements). So basically I need to create a List of Lists that

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-28 11:56

    import java.io.*;
    import java.util.*;
    class subsets
    {
        static String list[];
        public static void process(int n)
        {
            int i,j,k;
            String s="";
            displaySubset(s);
            for(i=0;i

提交回复
热议问题