Dsa
Bit Manipulation
Easy
Check Power of Two
Write a program that checks if a given positive integer is a power of two. The input consists of a single integer n (1 <= n <= 10^9). Print 'YES' if it is a power of two, and 'NO' otherwise.
Example:
Input:
8
Output:
YES
Key concepts
bit_manipulationchecking
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now