<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 {
        unordered_map<int,vector<int>> m;
public:
    bool same(int a,int b)
    {
        string s1=to_string(a);
        string s2=to_string(b);
        vector<int> v(10);
        for(auto &ch:s1)
        {
            v[ch-'0']++;
        }
        for(auto &ch:s2)
        {
            v[ch-'0']--;
        }
        for(int i=0;i<10;i++)
        {
            if(v[i]!=0)
            {
                return false;
            }
        }
        return true;
    }
    Solution(){
        int x=1;
        m[1].push_back(x);
        for(int i=1;i<=31;i++)
        {   
            x=x<<1;
            int digits=(to_string(x)).length();
            m[digits].push_back(x);
        }  
    }
    bool reorderedPowerOf2(int n) {
        int digits=(to_string(n)).length();
        for(auto &y:m[digits])
        {
            if(same(y,n))
            return true;
        }
        return false;
    }
};
9800