algorithms.tutorialhorizon.com
Given a number, write a program to find if number is power of two. | Algorithms
Given a number, write a program to find if number is power of two. Example: N = 5 Output: false. N = 8 Output: true (23) N = 512 Output: true (29) Approach: This problem can be solved in multiple ways; we will discuss three solutions here. Log2 Method Check the Remainder Convert number to bits