码迷,mamicode.com
首页 > 其他好文 > 详细

leetcode 1016. Binary String With Substrings Representing 1 To N

时间:2019-04-13 00:57:14      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:class   substring   最大   span   pre   repr   bin   tin   tco   

暴力就可以过,因为S最大1000,2的10次方就1024,后面的其实都不行.

class Solution(object):
    def queryString(self, S, N):
        if N>1024:return False
        return all(bin(i)[2:] in S for i in xrange(N,0, -1))
        

 

leetcode 1016. Binary String With Substrings Representing 1 To N

标签:class   substring   最大   span   pre   repr   bin   tin   tco   

原文地址:https://www.cnblogs.com/zywscq/p/10699291.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!