Java DFS Solution  with Explanation
Here we are trying every combination , first we are tryong every combination with 2 number .\nFor each combination , we are creating the whole input again and r
Here we are trying every combination , first we are tryong every combination with 2 number .\nFor each combination , we are creating the whole input again and running the dfs and repeat the same process .\n```\nclass Solution {\n    public boolean judgePoint24(int[] cards) {\n        List<Double> in=new ArrayList<>();\n        \n        for(int i : cards){\n            in.add((double)i);\n        }\n        \n        return dfs(in);\n    }\n    \n    \n    public boolean dfs(List<Double> cards){\n        if(cards.size()==1){\n            if(Math.abs(cards.get(0)-24.0)<0.001) return true;\n            return false;\n        }\n        \n        for(int i=0;i<cards.size();i++){\n            for(int j=i+1;j<cards.size();j++){\n                List<Double> possibleCombinations=generatePossibleResults(cards.get(i),cards.get(j));\n                \n                for(double c:possibleCombinations){\n                    List<Double> next=new ArrayList<>();\n                    next.add(c);\n                    \n                    for(int k=0;k<cards.size();k++){\n                        if(k!=i && k!=j) next.add(cards.get(k));\n                    }                    \n                    if(dfs(next)) return true;\n                } \n                \n            }\n        }\n        return false;\n    \n    }\n\n    private List<Double> generatePossibleResults(double a, double b) {\n        List<Double> res = new ArrayList<>();\n        res.add(a + b);\n        res.add(a - b);\n        res.add(b - a);\n        res.add(a * b);\n        res.add(a / b);\n        res.add(b / a);\n        return res;\n    }\n}\n```
['Depth-First Search', 'Java']