function reorderedPowerOf2(N) {
            var a1 = N.toString().split('')
            a1.sort((a, b) =>
                a.localeCompare(b)
            )

            var s1 = a1.join('')

            for (let i = 0; i < 31; i++) {
                var a2 = String(1 << i).split('')
                a2.sort((a, b) =>
                    a.localeCompare(b)
                )
                if (s1 === a2.join(''))
                    return true;
            }

            return false;
        }

相关文章:

  • 2021-09-19
  • 2021-06-19
  • 2021-07-29
  • 2022-12-23
  • 2021-04-15
  • 2021-04-23
  • 2021-05-22
猜你喜欢
  • 2021-10-03
  • 2022-02-04
  • 2022-12-23
  • 2021-05-02
  • 2021-06-23
  • 2021-10-16
  • 2022-02-01
相关资源
相似解决方案