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))