Leetcode 1065 Solution
This article provides solution to leetcode question 1065 (binary-string-with-substrings-representing-1-to-n)
Access this page by simply typing in "lcs 1065" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/binary-string-with-substrings-representing-1-to-n
Solution
class Solution:
def queryString(self, S: str, N: int) -> bool:
for i in range(1, N + 1):
if "{0:b}".format(i) not in S:
return False
return True