leetcode 1016. Binary String With Substrings Representing 1 To N

暴力就可以过,因为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))
        

猜你喜欢

转载自www.cnblogs.com/zywscq/p/10699291.html