Simple DFS java solution without rounding issue
\n\nclass Solution {\n    public boolean judgePoint24(int[] cards) {\n        List<Number> nums = List.of(\n            new Number(cards[0]),\n            new N
\n```\nclass Solution {\n    public boolean judgePoint24(int[] cards) {\n        List<Number> nums = List.of(\n            new Number(cards[0]),\n            new Number(cards[1]),\n            new Number(cards[2]),\n            new Number(cards[3]));\n        return dfs(nums);\n    }\n    \n    private boolean dfs(List<Number> nums) {\n        if (nums.size() == 1) {\n            return nums.get(0).equals(24);\n        }\n        \n        for (int i=0; i<nums.size(); i++) {\n            for (int j=i+1; j<nums.size(); j++) {\n                for (Number n : combine(nums.get(i), nums.get(j))) {\n                    List<Number> next = new ArrayList<>();\n                    next.add(n);\n                    for (int k=0; k<nums.size(); k++) {\n                        if (k != i && k != j) next.add(nums.get(k));\n                    }\n                    if (dfs(next)) return true;\n                }\n            }\n        }\n        return false;\n    }\n    \n    private List<Number> combine(Number n1, Number n2) {\n        List<Number> result = new ArrayList<>();\n        if (n1.equals(0) || n2.equals(0)) {\n            result.add(n1.equals(0) ? n2 : n1);\n            return result;\n        }\n        result.add(n1.add(n2));\n        result.add(n1.subtract(n2));\n        result.add(n2.subtract(n1));\n        result.add(n1.multiply(n2));\n        result.add(n1.divide(n2));\n        result.add(n2.divide(n1));\n        return result;\n    }\n    \n    private static class Number {\n        private final int dividend;\n        private final int divisor;\n        \n        public Number(int digit) {\n            this.dividend = digit;\n            this.divisor = 1;\n        }\n        \n        private Number(int dividend, int divisor) {\n            this.dividend = dividend;\n            this.divisor = divisor;\n        }\n        \n        public boolean equals(int num) {\n            return dividend % divisor == 0 && dividend / divisor == num;\n        }\n        \n        public Number add(Number o) {\n            return new Number(dividend * o.divisor + o.dividend * divisor, \n                              divisor * o.divisor);\n        }\n        \n        public Number subtract(Number o) {\n            return new Number(dividend * o.divisor - o.dividend * divisor, \n                              divisor * o.divisor);   \n        }\n        \n        public Number multiply(Number o) {\n            return new Number(dividend * o.dividend, divisor * o.divisor);\n        }\n        \n        public Number divide(Number o) {\n            if (o.dividend == 0) {\n                throw new IllegalArgumentException("Invalid division by zero");\n            }\n            return new Number(dividend * o.divisor, divisor * o.dividend);\n        }\n    }\n}\n```
[]