# O(1) Check Power of 2

Using O(1) time to check whether an integer n is a power of 2.

```
n = 1 = 001 Yes, power of 2
n = 4 = 100 Yes, power of 2
n = 5 = 101 No, not power of 2
```

Using O(1) time to check whether an integer n is a power of 2.

```
n = 1 = 001 Yes, power of 2
n = 4 = 100 Yes, power of 2
n = 5 = 101 No, not power of 2
```