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. 【pattern】设计模式(2) - 模版方法模式

    前言 一晃一年又过了,还是一样的渣. 一晃2周又过去了,还是没有坚持写博客. 本来前2天说填一下SQL注入攻击的坑,结果看下去发现还是ojdbc.jar中的代码,看不懂啊.这坑暂时填不动,强迫在元旦最 ...

  2. javascript 权威指南二

    1.JavaScript程序是用Unicode字符集编写的.Unicode 是ASCII和Latin-1的超级,并支持地球上几乎所有在用的语言. 2.JavaScript是区分大小写的语言.HTML并 ...

  3. 内网IPC$入侵加pstools之远程控制

    前言: IPC$(Internet process connection)是指内网里面的文件共享连接,通常很多机子的默认共享都是打开的,在cmd下使用命令net share可查看自己的IPC$是否打开 ...

  4. PAT (Basic Level) Practice (中文)1023 组个最小数 (20 分) (排序)

    给定数字 0-9 各若干个.你可以以任意顺序排列这些数字,但必须全部使用.目标是使得最后得到的数尽可能小(注意 0 不能做首位).例如:给定两个 0,两个 1,三个 5,一个 8,我们得到的最小的数就 ...

  5. 浅谈C#委托的用法-delegate[转]

    一.委托的概念 委托和类一样是一种用户自定义类型,它存储的就是一系列具有相同签名和返回类型的方法的地址,调用委托的时候,它所包含的所有方法都会被执行. 借用百度上的一句话概括:委托是一个类,它定义了方 ...

  6. c# 调用c++类库控制usb继电器

    网上找不到调用此类库的文章,简单写一下,以备后用. 下面是封装后的调用c++类库的类 public class UsbRelayDeviceHelper { /// <summary> / ...

  7. [Python]爬取CSDN论坛 标题 2020.2.8

    首先新建一个Lei.txt 内容为: CloudComputingParentBlockchainTechnologyEnterpriseDotNETJavaWebDevelopVCVBDelphiB ...

  8. Win10安装1 —— 引言与目录

    本文内容皆为作者原创,如需转载,请注明出处:https://www.cnblogs.com/xuexianqi/p/12368107.html 一:引言 众所周知,电脑出现问题了后,重启 可以解决90 ...

  9. H3C IP路由基础

    一.路由简介 在网络中路由器根据所收到的报文的目的地址选择一条合适的路径,并将报文转发到下一个路由器.路径中最后一个路由器负责将报文转发给目的主机. 路由就是报文在转发过程中的路径信息,用来指导报文转 ...

  10. Nginx 配置Websocket

    Nginx反向代理配置websocket nginx.org 官网推荐如下的配置,也可以直接看官网:http://nginx.org/en/docs/http/websocket.html http ...