Bitmask Solution || OVERKILL
1.Use all mask from 1 to 14 ("1111" means 15 so, we have to take 14 as upper bound so that non-empty 2nd list is formed)\n2.Make two list for each mask(1st list
1.Use all mask from 1 to 14 ("1111" means 15 so, we have to take 14 as upper bound so that non-empty 2nd list is formed)\n2.Make two list for each mask(1st list - set bits, 2nd list-unset bits)\n3.Sort those list\n4.Form two number from those lists\n5.Calculate sum\n6.Track minimum\n\nJAVA OVERKILL SOLN.\n\n```\nclass Solution {\n    public int minimumSum(int num) {\n        int sum=Integer.MAX_VALUE;\n        StringBuilder sb=new StringBuilder();\n        sb.append(num);\n        String y=sb.toString();\n        char ar[]=y.toCharArray();\n        for(int i=1;i<15;i++)\n        {\n            ArrayList<Character> al1=new ArrayList<>();\n            ArrayList<Character> al2=new ArrayList<>();\n            for(int j=1;j<=4;j++)\n            {\n              if((i & (1 << (j - 1))) > 0)\n                  al1.add(ar[j-1]);\n              else\n                  al2.add(ar[j-1]);\n            }\n          int si1=al1.size();\n          char a1[]=new char[si1];\n          for(int j=0;j<si1;j++)\n             a1[j]=al1.get(j);\n          \n           int si2=al2.size();\n          char a2[]=new char[si2];\n          for(int j=0;j<si2;j++)\n             a2[j]=al2.get(j);\n          \n            Arrays.sort(a1);\n            Arrays.sort(a2);\n            String x1=new String(a1);\n            String x2=new String(a2);\n            int temp=0;\n            temp+=Integer.parseInt(x1);\n            temp+=Integer.parseInt(x2);\n            sum=Math.min(sum,temp);\n          \n        }\n      return sum;\n    }\n}\n```
['Bitmask', 'Java']