## How to check if Number is a power of 2 or not

Problem: Given a number we need to tell if it is a power of two or not? Example: Input: 8 Ans: Yes Solution: Here we just need to take Bitwise and (&) of N and (N-1), if its 0, the YES else NO. Explanation For power of 2: 8 is represented in binary as 1000,… Read More »