cswork / OAOpen practice workspace

Valkyrie TradingOA #4

Is Power of 2

EasyJudge-ready

Topics (AI-labelled)Bits & Math

Given an integer n, return 1 if n is a non-negative integer power of 2, otherwise return 0. In the example, 1=2⁰, so 1 is a power of 2.

This site adds the standard input/output protocol.

Input

Input a signed 32-bit integer n (−2^31≤n≤2^31−1); the range is filled in according to the int type in the original function signature.

Output

Output 1 or 0.

Example 1

Input:

1

Output:

1

Example 2

Input:

2

Output:

1

Example 3

Input:

3

Output:

0

Editorial

Loading solution…