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;
}

leetcode 869. Reordered Power of 2的更多相关文章

  1. LC 869. Reordered Power of 2

    Starting with a positive integer N, we reorder the digits in any order (including the original order ...

  2. 【LeetCode】869. Reordered Power of 2 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 字典统计每位数字出现的次数 日期 题目地址:http ...

  3. 869. Reordered Power of 2

    Starting with a positive integer N, we reorder the digits in any order (including the original order ...

  4. 【一天一道LeetCode】#342. Power of Four

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...

  5. [LeetCode] Reordered Power of 2 重新排序为2的倍数

    Starting with a positive integer N, we reorder the digits in any order (including the original order ...

  6. 【一天一道LeetCode】#231. Power of Two

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...

  7. 【一天一道LeetCode】#326. Power of Three

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...

  8. [Swift]LeetCode869. 重新排序得到 2 的幂 | Reordered Power of 2

    Starting with a positive integer N, we reorder the digits in any order (including the original order ...

  9. 【LeetCode】342. Power of Four 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 递归 迭代 位运算 函数法 日期 [LeetCode ...

随机推荐

  1. [Python]scatter_matrix报错 module 'pandas' has no attribute 'scatter_matrix'

    运行pandas.scatter_matrix()散点图函数时报错, 原因是该函数在新版本用法发生了变化: pandas.plotting.scatter_matrix 完整用法:pd.plottin ...

  2. 使用phpstudy向mysql中导入数据

  3. 论文阅读笔记(十九)【ITIP2017】:Super-Resolution Person Re-Identification With Semi-Coupled Low-Rank Discriminant Dictionary Learning

    Introduction (1)问题描述: super resolution(SP)问题:Gallery是 high resolution(HR),Probe是 low resolution(LR). ...

  4. caj文件转word

    转载:https://baijiahao.baidu.com/s?id=1590365105855177484&wfr=spider&for=pc 使用工具: 迅捷caj转word转换 ...

  5. Java课后总结-原码、补码、反码

    1.原码.补码.反码的定义和表示方法. 数在计算机中是以二进制形式表示的. 数分为有符号数和无符号数. 原码.反码.补码都是有符号定点数的表示方法. 一个有符号定点数的最高位为符号位,0是正,1是副. ...

  6. 《操作系统真象还原》MBR

    以下是读本书第三章的收获. 如何知道一个源程序的各符号(指令和变量)地址?简单来说,地址就是该符号偏移文件开头的距离,符号的地址是按顺序编排的,所以两个相邻的符号,其地址也是相邻的.对于指令来说,指令 ...

  7. 问题 C: 查找

    #include <cstdio> #include <vector> #include <algorithm> using namespace std; bool ...

  8. xampp安装配置比较容易卡住的地方

    xampp作为一款集成建站软件,方便了不少初学的开发者,但是虽然是集成和傻瓜式的安装,还是会遇到一些容易卡壳的地方,这里记录自己觉得一些比较重要的东西. 1.端口问题 如图是我改之后的端口,原来端口为 ...

  9. vue里使用element饿了么的el-menu+vue-router实现路由跳转的两种方法

    最近准备写一个echarts的可视化展示案例,首先用vue-cli3创建了一个项目(好像vue-cli4也出来,感觉变化不大,就没升级了) 然后,开始配置路由↓下面是我的router.js文件 imp ...

  10. Java连载76-基础数据类型包装类型及其方法简介

    一.java中八种基本数据类型对应的包装类型 基本数据类型      包装类型 byte                    java.lang.Byte short                ...