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