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 | Set-2
- Minimum rotations required to get the same string
- Binary Search a String
- Check if strings are rotations of each other or not | Set 2
- Check if two numbers are bit rotations of each other or not
- Count rotations divisible by 4
- Convert String into Binary Sequence
- Check if a binary string contains consecutive same or not
- Construct a binary string following the given constraints
- Binary tree to string with brackets
- Calculate score for the given binary string
- Check if all the 1's in a binary string are equidistant or not
- Check if binary string multiple of 3 using DFA
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.