23. Check If a Number Is a Power of Two

Write a function to check if a given positive integer is a power of 2. Do not use loops, multiplication, division, or library functions.
You must solve it using bitwise logic only.

 

Example-1

Input:  n = 8  
Output: YES


Example-2

Input:  n = 7  
Output: NO


Example-3

Input:  n = 1  
Output: YES
Loading...

Input

8

Expected Output

YES