You are given a non-negative integer n.
Your task is to determine whether n is a power of two.
You may assume that:
n is a non-negative integer.Return true if n is a power of two, and false otherwise.
8
True
8 in binary is 1000, which has exactly one set bit, so it is a power of two (2^3 = 8).
5
False
5 in binary is 101, which has more than one set bit, so it is not a power of two.
0
False
0 is not a power of two.
8
True