class Solution(object):
def queryString(self, S: str, N: int) -> bool:
return all(S.find(bin(i)[2:]) != -1 for i in range(N, N//2 - 1, -1))

leetcode1016的更多相关文章

  1. [Swift]LeetCode1016. 子串能表示从 1 到 N 数字的二进制串 | Binary String With Substrings Representing 1 To N

    Given a binary string S (a string consisting only of '0' and '1's) and a positive integer N, return ...

随机推荐

  1. java.util.ConcurrentModificationException的解决办法

    今天在使用iterator.hasNext()操作迭代器的时候,当迭代的对象发生改变,比如插入了新数据,或者有数据被删除. 编译器报出了以下异常: Exception in thread " ...

  2. 生成器&迭代器,模块

    列表生成式 将列表data=[1,2,3]里的元素都乘2 方法一 data=[1,2,3] for index,i in enumerate(data): data[index] *=2 print( ...

  3. 开始创作自己的VR作品——VR故事叙述终极指南

    转自:http://www.52vr.com/article-1870-1.html       在8月份,YouTube Space LA开展了“VR Creator Lab”的活动,为期三个月.参 ...

  4. Postgresql 珍藏级文章

    https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server  如何设置参数值 https://www.cnblogs.com/zhao ...

  5. python各种推导式

    字典推导式 例一:将一个字典的key和value对调 mcase = {, } mcase_frequency = {mcase[k]: k for k in mcase} print(mcase_f ...

  6. 网络基础和python

    ·五层协议 物理层,数据链路层,网络层,传输层,应用层 ·用户上网流程 1.本机获取 2.打开浏览器,,输入网址. 3.dns协议(基于udp协议) 4.HTTP部分的内容 5 TCP协议 6 IP协 ...

  7. CS229 6.8 Neurons Networks implements of PCA ZCA and whitening

    PCA 给定一组二维数据,每列十一组样本,共45个样本点 -6.7644914e-01  -6.3089308e-01  -4.8915202e-01 ... -4.4722050e-01  -7.4 ...

  8. log4js 2.X版本配置详解

    const log4js = require('log4js'); log4js.configure({ appenders: { cheese: { type: 'file', filename: ...

  9. FileInputStream与FileOutputStream 复制文件例子代码

    try { File sourceFile = new File("C:\\Users\\prize\\Desktop\\Demo1\\盗墓笔记7.txt");//创建源文件 In ...

  10. ASP.NET WebApi 图片上传

    以下是代码的实现过程: Html页面表单布局: <form id="UpPicture" enctype="multipart/form-data" ac ...