<p>You are given an integer <code>n</code>. We reorder the digits in any order (including the original order) such that the leading digit is not zero.</p>

<p>Return <code>true</code> <em>if and only if we can do this so that the resulting number is a power of two</em>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> n = 1
<strong>Output:</strong> true
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> n = 10
<strong>Output:</strong> false
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= n &lt;= 10<sup>9</sup></code></li>
</ul>

class Solution {
public:
    bool reorderedPowerOf2(int n) {
        string num=to_string(n);
        int d=num.size();
        long long p2=1;
        vector<string>poss;
        while(true)
        {
            string a=to_string(p2);
            int sz=a.size();
            if(sz>d)break;
            if(sz==d)poss.push_back(a);
            if(1LL*p2*2>1e9)break;
            p2*=2;
        }
        if(poss.empty())return 0;
        sort(num.begin(),num.end());
        for(auto it:poss)
        {
            string a=it;
            sort(a.begin(),a.end());
            if(a==num)return 1;
        }
        return 0;
    }
};
9000