[Java][DFS]
Given:            (a, b, c, d) - (A tuple of 4)\nGenerate: \nEdited: Thanks to @bellevue \n ((a+b),c,d) ((a-b),c,d) ((b-a),c,d) ((ab),c,d) ((a/b),c,d) ((b/a),c,
**Given**:            (a, b, c, d) - (A tuple of 4)\n**Generate**: \nEdited: Thanks to @bellevue \n* ((a+b),c,d) ((a-b),c,d) ((b-a),c,d) ((a*b),c,d) ((a/b),c,d) ((b/a),c,d)\n* ((a+c),b,d)  .................................................................  ((c/a),b,d)\n* ((a+d),b,c)  ................................................................. ((d/a),b,c)\n* (a,(b+c),d) .................................................................  (a,(c/b),d)\n* (a,(b+d),d) .................................................................  (a,(d/b),d)\n* (a,b,(c+d)) .................................................................  (a,b,(d/c))\n\nThere are 36 (6*6) such tuples. Of these, + & - are not order dependent. That is 2+3 = 3+2. But / & - are order dependent. i.e. 2/3 != 3/2. These look like (e,f,g) i.e. a tuple of 3 now.\n\n* Carrying out similar reductions gives 18 (6*3) tuples for each of the above-generated tuples. These now look like (h, i) i.e. a tuple of 2 now.\n\n* Similiar, the final reduction now yields 6 answers (a+b, a-b, a*b, a/b, b-a, b/a) for each of the above-generated tuple.\n\nThus in total 36x18x6 final values can be generated using the 4 operators and 4 initial values.\n\n**Algo**: Generate all such answers using dfs method and stop when it's 24.\n\n**Catches**:\n\n* Use ``` double ``` instead of ```int```\n* Be careful about the classical ``` divide by zero ``` error\n\n```\nclass Solution {\n    enum ops{\n\tADD('+'), SUB('-'), MUL('*'), DIV('/');\n\tchar type;\n\tops(char c){\n\t\ttype = c;\n\t}\n\tpublic double doFunc(double a, double b){\n\t\tif(type=='+') return a+b;\n\t\tif(type=='-') return a-b;\n\t\tif(type=='*') return a*b;\n\t\telse return a/b;\n\t}\n}\n    static ops[] operations;\n    public static boolean judgePoint24(int[] nums) {\n\t\toperations = ops.values();\n\t\tdouble[] oops = new double[4];\n\t\tfor(int i=0;i<4;i++)\n\t\t\toops[i] = 1.0*nums[i];\n        return doit(oops,4,new boolean[]{true,true,true,true});\n    }\n    public static boolean doit(double[] nums,int count,boolean[] use){\n    \tif(count==1){\n    \t\tfor(int i=0;i<4;i++)\n    \t\t\tif(use[i] && nums[i]==24.0) return true;\n    \t\treturn false;\n    \t}\n        for(int i=0;i<4;i++){\n        \tif(use[i]){\n        \t\tfor(int j=0;j<4;j++){\n        \t\t\tif(j!=i && use[j]){\n        \t\t\t\tdouble a = nums[i];\n        \t\t\t\tuse[j] = false;\n        \t\t\t\tboolean r = false;\n        \t\t\t\tfor(int ai=0;ai<ops.values().length;ai++){\n        \t\t\t\t\tif((operations[ai]==ops.ADD || operations[ai]==ops.MUL) && j<i) continue;\n        \t\t\t\t\tif(operations[ai]==ops.DIV && nums[j]==0) continue;\n        \t\t\t\t\tnums[i] = operations[ai].doFunc(a, nums[j]);\n        \t\t\t\t\tr = r|| doit(nums,count-1,use);\n        \t\t\t\t\tif(r) return r;\n        \t\t\t\t}\n        \t\t\t\tnums[i] = a;\n        \t\t\t\tuse[j] = true;\n        \t\t\t}\n        \t\t}\n        \t}\n        \t\n        }\n        return false;\n    }\n}\n```\nPS: Comments are appreciated.
[]