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