Skip to content

Commit f581e7d

Browse files
authored
Merge pull request #2383 from younessZMZ/b1
Create 1461-check-if-a-string-contains-all-binary-codes-of-size-k.py
2 parents 48dfc74 + 7406285 commit f581e7d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def hasAllCodes(self, s: str, k: int) -> bool:
3+
return len(set(s[i : i + k] for i in range(len(s) - k + 1))) == 2**k

0 commit comments

Comments
 (0)