leetcode1016】的更多相关文章

Given a binary string S (a string consisting only of '0' and '1's) and a positive integer N, return true if and only if for every integer X from 1 to N, the binary representation of X is a substring of S. Example 1: Input: S = "0110", N = 3 Outp…
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))…