Dsa
Bit Manipulation
Medium
Power of Two Checker
Write a function that checks if a given positive integer `N` is a power of two. A number is a power of two if it can be expressed as 2^k for some non-negative integer k.
Input format:
- A single positive integer N.
Output format:
- Print 'YES' if N is a power of two, otherwise print 'NO'.
Example:
Input:
16
Output:
YES
Key concepts
bitmanipulationpoweroftwo
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