Given a non-negative integer n. The problem is to find the smallest perfect power of 2 which is greater than n without using the arithmetic operators.
Input : n = 10 Output : 16 Input : n = 128 Output : 256
Perfect power of 2 greater than 128: 256
Time Complexity: O(num), where num is the number of bits in the binary representation of n.
- Check if n is divisible by power of 2 without using arithmetic operators
- Smallest power of 2 greater than or equal to n
- Smallest power of 2 which is greater than or equal to sum of array elements
- Subtract 1 without arithmetic operators
- Add two numbers without using arithmetic operators
- Subtract two numbers without using arithmetic operators
- Check if two numbers are equal without using arithmetic and comparison operators
- Smallest of three integers without comparison operators
- Find the sum of power of bit count raised to the power B
- Operators in C | Set 2 (Relational and Logical Operators)
- Check if given number is a power of d where d is a power of 2
- Minimum digits to remove to make a number Perfect Square
- Queries to find the maximum Xor value between X and the nodes of a given level of a perfect binary tree
- Bitwise Operators in C/C++
- Multiply a number by 15 without using * and / operators
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.
Improved By : Mithun Kumar