Power of Two
EasyGiven a positive integer
n, write a function that returns whether n is a power of 2.For example, if
n = 4, your function should return True.If
n = 5, your function should return FalseTry it first
Solution
6 Essential Primitives Coding Interview Problems
Master Primitives by trying the coding challenges below.
- 1.Swap bitsEasy
- 2.Power of twoEasy
- 3.Count bitsMedium
- 4.Reverse bitsMedium
- 5.Find duplicateMedium
- 6.Bitwise additionHard