Given a binary string str, the task is to find the largest power of 2 that divides the decimal equivalent of the given binary number.
Input: str = “100100”
22 = 4 is the highest power of 2 that divides 36 (100100).
Input: str = “10010”
Approach: Starting from the right, count the number of 0s in the binary representation which is the highest power of 2 which will divide the number.
Below is the implementation of the above approach:
- Highest power of a number that divides other number
- Highest power of two that divides a given number
- Count of pairs in an array such that the highest power of 2 that divides their product is 1
- Highest power of 2 that divides the LCM of first N Natural numbers.
- Find two co-prime integers such that the first divides A and the second divides B
- Count of triplets (a, b, c) in the Array such that a divides b and b divides c
- Highest power of 2 less than or equal to given number
- Find maximum power of a number that divides a factorial
- Highest power of 2 less than or equal to given Integer
- Highest and Smallest power of K less than and greater than equal to N respectively
- Smallest number greater than n that can be represented as a sum of distinct power of k
- Modulo power for large numbers represented as strings
- Check if given number is a power of d where d is a power of 2
- Check if a M-th fibonacci number divides N-th fibonacci number
- Count of prime digits of a Number which divides the number
- Check in binary array the number represented by a subarray is odd or even
- Find power of power under mod of a prime
- Compute power of power k times % m
- Larger of a^b or b^a (a raised to power b or b raised to power a)
- Find the sum of power of bit count raised to the power B
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.