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. Winform中怎样对窗体进行隐藏,再次打开时仍然保留上次的窗体

    场景 点击按钮后打开窗口,点击窗口的确定按钮后即使窗体返回了Ok,此时不关闭窗体,将窗体隐藏. 再次点击按钮后,仍然打开上次的窗体. 注: 博客主页: https://blog.csdn.net/ba ...

  2. 【33】卷积步长讲解(Strided convolutions)

    卷积步长(Strided convolutions) 卷积中的步幅是另一个构建卷积神经网络的基本操作,让我向你展示一个例子. 如果你想用3×3的过滤器卷积这个7×7的图像,和之前不同的是,我们把步幅设 ...

  3. sql注入常见绕过技巧

    参考链接:https://blog.csdn.net/huanghelouzi/article/details/82995313 https://www.cnblogs.com/vincy99/p/9 ...

  4. CF573E Bear and Bowling(6-1)

    题意 洛谷 做法一 考虑一种贪心(先别管对不对),设当前已选择的集合为\(A\),这是考虑该集合的补集,每个元素加进来后的增量为\(V_i\),则挑选最大的那个加入该集合 结论1:遵循上述贪心,\(\ ...

  5. jsp虚拟路径与虚拟主机

    配置虚拟路径 方式一: 在Tomcat根目录下的webapps就是一个虚拟路径,conf目录下的server.xml文件里配置 //默认的虚拟路径 <Engine name="Cata ...

  6. IDEA 解决Number objects are compared using '==', not 'equals()' 警告

    当代码被工具标黄色高亮时,代表需要优化或重构了 == 是值相等.对于Integer这样的数据类型而言,意义是两个Integer对象的内存地址相等.也就是说如果你有两个不同的Integer的对象, 如果 ...

  7. 对one hot 编码的理解,sklearn. preprocessing.OneHotEncoder()如何进行fit()的?

    查阅了很多资料,逐渐知道了one hot 的编码,但是始终没理解sklearn. preprocessing.OneHotEncoder()如何进行fit()的?自己琢磨了一下,后来终于明白是怎么回事 ...

  8. sqlalchemy_mptt一次调优

    问题背景: 我用sqlalchemy_mptt构建了一个多级分类项目,数据库用了sqlite.随着数据条数越来越多,写入速度逐渐变慢,一棵树的插入甚至需要1分钟,远远不能满足需求 分析思路: 1. 批 ...

  9. 51Nod 1091 线段的重叠 (贪心)

    X轴上有N条线段,每条线段包括1个起点和终点.线段的重叠是这样来算的,[10 20]和[12 25]的重叠部分为[12 20]. 给出N条线段的起点和终点,从中选出2条线段,这两条线段的重叠部分是最长 ...

  10. C#之Quartz任务调度的使用(2.2.3.400)

    这里使用的Quartz版本号为2.2.3.400,.net 框架为4.0. 目的实现一个小案例,每隔一秒钟打印一条记录.后面会附上源码,以供参考. 建立一个  控制台程序. 代码: class Pro ...