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. Educational Codeforces Round 80 (Rated for Div. 2)(A-E)

    C D E 这三道题感觉挺好       决定程序是否能通过优化在要求的时间内完成,程序运行时间为t,你可以选择花X天来优化,优化后程序的运行时间为t/(x+1)取上整,花费的时间为程序运行时间加上优 ...

  2. 牛客寒假6-F十字阵列

    链接:https://ac.nowcoder.com/acm/problem/201986来源:牛客网 题目描述 小 Q 新学会了一种魔法,可以对一个 N行M列 的网格上的敌人造成伤害 第 i 次使用 ...

  3. FHQTreap刷题记录

    分裂:如图,按值分裂,u比k大则切黄色的一

  4. Redis可能出现的问题

    缓存穿透 一般出现这样的问题,是因为当我们查询一条肯定不存在的数据的时候,缓存中没有,就会透过缓存来查询数据库,数据库也不存在,这样就不会将值保存在缓存中,最后还是缓存和数据库中都没有,如果一直访问这 ...

  5. 回溯经典(指定位置N皇后问题)

    N皇后问题自不必多说,这道题的先行条件是在放置的时候已经指定了一个棋子的位置. 输入第一行为N,第二行为指定棋子的坐标(x,y):输出方案总数以及按字典序升序的各种方案. 思路: 首先是回溯,其次对待 ...

  6. ECMAScript规范中第六大基本类型 Symbol

    初步了解第六大基本类型Symbol 概述: 什么是Symbol.Symbol是一个标记,一个独一无二的记号. Symbol的出现主要是解决了以前ES5中两个问题 在属性中同名的属性会被覆盖 无法做到属 ...

  7. 关于docker容器访问的主机的端口问题

    docker容器需要访问主机的,不能使用127.0.0.1,127.0.0.1访问的是docker容器不是主机: docker容器创建时会分配一个主机ip,可在主机使用命令 docker inspec ...

  8. 数据预处理 | 使用 pandas.to_datetime 处理时间类型的数据

    数据中包含日期.时间类型的数据可以通过 pandas 的 to_datetime 转换成 datetime 类型,方便提取各种时间信息 1 将 object 类型数据转成 datetime64 1&g ...

  9. 斜率优化 DP

    CF311B Cats Transport 暑假到现在终于过了这道题

  10. [POI2008] STA-Station - 树形dp

    很显然的递推式ans[q] = ans[p] + n - 2*siz[q]; 这么个题你卡我常干嘛,害得我加快读 (谁叫我是vector党呢 #include <bits/stdc++.h> ...