VOOZH about

URL: https://www.geeksforgeeks.org/dsa/smallest-perfect-power-2-greater-n-without-using-arithmetic-operators/

⇱ Smallest perfect power of 2 greater than n (without using arithmetic operators) - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Smallest perfect power of 2 greater than n (without using arithmetic operators)

Last Updated : 15 Jun, 2022

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.
Examples : 
 

Input : n = 10
Output : 16

Input : n = 128
Output : 256


 


Algorithm : 
 

👁 Image


 

Output: 

Perfect power of 2 greater than 128: 256


Time Complexity: O(logn)
Auxiliary Space: O(1)

Comment
Article Tags:
Article Tags: