Given a binary string and k, to check whether it’s contains all permutations of length k or not.
Input : Binary string 11001 k : 2 Output : Yes 11001 contains all possibilities of binary sequences with k = 2, 00, 01, 10, 11 Input : Binary string: 1001 k : 2 Output: No 1001 does not contain all possibilities of binary sequences with k = 2. Here 11 sequence is missing
In this example one binary sequence of length k is not found it is 0110.
So all binary sequences with k=4 will be 24=16. they are following
0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111,
1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111
All should be sub string of given binary string then print Yes otherwise No
Taking binary string and the size k. In binary string we check binary sequences are matched or not. Binary sequence is made of size k, as we know that in binary using 0 and 1 digit so to generate total binary subsets is 2k element. The main idea behind it, to store all binary value in list as string and then compare list all item to given binary string as subset. If all are occur inside the binary string then print “Yes” otherwise print “No”.
- Count of cyclic permutations having XOR with other binary string as 0
- Number of unique permutations starting with 1 of a Binary String
- Check if given string can be formed by two other strings or their permutations
- Generate all binary permutations such that there are more or equal 1's than 0's before every point in all permutations
- Check if a string contains a palindromic sub-string of even length
- Binary String of given length that without a palindrome of size 3
- Length of longest consecutive ones by at most one swap in a Binary String
- Generate all binary strings of length n with sub-string "01" appearing exactly twice
- Maximum length of consecutive 1's in a binary string in Python using Map function
- Check if string can be rearranged so that every Odd length Substring is Palindrome
- Check length of a string is equal to the number appended at its last
- Check if the frequency of any character is more than half the length of the string
- Number of ways to make binary string of length N such that 0s always occur together in groups of size K
- Python | Check if a given string is binary string or not
- Check if a binary string contains consecutive same or not
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.