C++, Concise code
\nclass Solution {\npublic:\n    bool judgePoint24(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        do {\n            if (valid(nums)) ret
```\nclass Solution {\npublic:\n    bool judgePoint24(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        do {\n            if (valid(nums)) return true;\n        } while(next_permutation(nums.begin(), nums.end()));\n        return false;\n    }\nprivate:\n    bool valid(vector<int>& nums) {\n        double a = nums[0], b = nums[1], c = nums[2], d = nums[3];\n        if (valid(a+b, c, d) || valid(a-b, c, d) || valid(a*b, c, d) || valid(a/b, c, d)) return true;\n        if (valid(a, b+c, d) || valid(a, b-c, d) || valid(a, b*c, d) || valid(a, b/c, d)) return true;\n        if (valid(a, b, c+d) || valid(a, b, c-d) || valid(a, b, c*d) || valid(a, b, c/d)) return true;\n        return false;\n    }\n    bool valid(double a, double b, double c) {\n        if (valid(a+b, c) || valid(a-b, c) || valid(a*b, c) || b&&valid(a/b, c)) return true;\n        if (valid(a, b+c) || valid(a, b-c) || valid(a, b*c) || c&&valid(a, b/c)) return true;\n        return false;\n    }\n    bool valid(double a, double b) {\n        if (abs(a+b-24.0) < 0.0001 || abs(a-b-24.0) < 0.0001 || abs(a*b-24.0) < 0.0001 || b&&abs(a/b-24.0) < 0.0001) \n            return true;\n        return false;\n    }\n};\n```
[]