Javascript | Easy to Understand | Fully explained | Power of 2 |  Simple
\n//Main function\nvar reorderedPowerOf2 = function(n) {\n let arr = FindDigitMapArray(n);\n    \n for(let i=0;i<31;i++){ //Till value of power of 2 is less tha
```\n//Main function\nvar reorderedPowerOf2 = function(n) {\n let arr = FindDigitMapArray(n);\n    \n for(let i=0;i<31;i++){ //Till value of power of 2 is less than 10^9 or 2^32 find all such power of 2\n      let num = Math.pow(2,i);\n      let twoArray = FindDigitMapArray(num);\n       if(CheckTwoArraysAreEqual(arr,twoArray)) return true;\n }\n    return false;\n}\n\n//Function to generate digit map\nvar FindDigitMapArray = function(n){ //For a given number it stores the count of digit on respective index.\n    let arr = Array(10).fill(0);\n    while(n>0){\n        arr[n%10]+=1;\n        n/=10;\n        n=Math.floor(n);\n    }\n    return arr;\n}\n\n//Function to check if two arrays are equal\nvar CheckTwoArraysAreEqual = function(arr,twoArray){\n     let count = 0;\n    for(let i=0;i<10;i++){ //Check if digit map of both numbers are equal\n     if(twoArray[i]==arr[i]){\n            count++;\n        }\n    }\n    if(count==10) return true;\n}\n```
['JavaScript']