首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
leetcode1016
】的更多相关文章
[Swift]LeetCode1016. 子串能表示从 1 到 N 数字的二进制串 | Binary String With Substrings Representing 1 To N
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…
leetcode1016
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))…