Power of Two Check

JavaScript Easy 2 views
Back to Questions
Next Mini Calculator (No eval) Medium N

Problem Description

Given an integer n, print YES if it is a power of 2, else print NO. Use bit logic, not loops.

Input Format

One integer n.

Output Format

YES or NO.

Sample Test Case

Input:
16
Output:
YES

Constraints

n is a 32-bit signed integer.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Next