Given a binary string. We are allowed to do circular rotation of the string without changing the relative order of the bits in the string.
For Example, all possible circular rotation of string “011001” are:
101100 010110 001011 100101 110010
We are required to tell total number of distinct odd decimal equivalent possible of binary string, by doing circular rotation.
Input : 011001 Output : 3 Explanation: All odd possible binary representations are: ["011001", "001011", "100101"] Input : 11011 Output : 4 Explanation: All odd possible binary representations are: ["11011", "01111", "10111", "11101"]
It can be observed that a binary string can only be odd if it’s last bit is 1, because the value of last bit is 2^0.Hence, since we are doing circular rotation.
- Maximum contiguous 1 possible in a binary string after k rotations
- Generate all rotations of a given string
- Minimum rotations required to get the same string
- Minimum rotations required to get the same String | Set-2
- Longest sub string of 0's in a binary string which is repeated K times
- Check if strings are rotations of each other or not | Set 2
- Count rotations divisible by 4
- Check if two numbers are bit rotations of each other or not
- Binary Search a String
- A Program to check if strings are rotations of each other or not
- Count of substrings of a binary string containing K ones
- Calculate score for the given binary string
- Check if binary string multiple of 3 using DFA
- Modulo of a large Binary String
- Check divisibility of binary string by 2^k
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.