Rust | O(1) | 1ms
Intuition\nCheck if number has digits matching any power of two.\n\n# Approach\nTake digits of every power of two into an array, sort them and store them in a s
# Intuition\nCheck if number has digits matching any power of two.\n\n# Approach\nTake digits of every power of two into an array, sort them and store them in a set. Then see if the digits array of given number is present in the set.\n\n# Complexity\n- Time complexity: $$O(1)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nuse std::collections::*;\nimpl Solution {\n    pub fn reordered_power_of2(n: i32) -> bool {\n        let mut set = HashSet::new();\n        let num_2_set = |mut n: i32| -> Vec<i32> {\n            let mut v = Vec::with_capacity(10);\n            while n > 0 {\n                v.push(n%10);\n                n /= 10;\n            }\n            v.sort();\n            v\n        };\n        for i in 0..31 {\n            set.insert(num_2_set(1 << i));\n        }\n        set.contains(&(num_2_set(n)))\n    }\n}\n```
['Rust']