Rust || 1ms || beats 100%
Complexity\n- Time complexity: O(2^n) = O(2^4)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(2^n) = O(2^4)\n Add your space complexity he
# Complexity\n- Time complexity: $$O(2^n) = O(2^4)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(2^n) = O(2^4)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimpl Solution {\n    pub fn judge_point24(mut cards: Vec<i32>) -> bool {\n        let cards = cards.into_iter().map(|c| c as f64).collect::<Vec<_>>();\n        fn prod_div_sum_diff(a: f64, b: f64) -> [f64; 6] {\n            [a * b, if b == 0.0 {f64::MAX} else {a/b}, if a == 0.0 {f64::MAX} else {b/a},\n            a + b, a - b, b - a]\n        };\n        fn dfs(cards: &Vec<f64>) -> bool {\n            if cards.len() == 1 {\n                return (cards[0] - 24.0).abs() < 0.001;\n            }\n            for i in 0..cards.len() {\n                for j in i+1..cards.len() {\n                    let mut new_cards = vec![];\n                    for k in 0..cards.len() {\n                        if k != i && k != j {\n                            new_cards.push(cards[k]);\n                        }\n                    }\n                    for &result in prod_div_sum_diff(cards[i], cards[j]).iter() {\n                        if result == f64::MAX {\n                            continue;\n                        }\n                        new_cards.push(result);\n                        if dfs(&new_cards) {\n                            return true;\n                        }\n                        new_cards.pop();\n                    }\n                }\n            }\n            false\n        }\n        dfs(&cards)\n    }\n}\n```
['Rust']