MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / isPowerOfTwo

Function isPowerOfTwo

Python/CheckPowerOf2.py:4–5  ·  view source on GitHub ↗
(self, n: int)

Source from the content-addressed store, hash-verified

2#An integer n is a power of two, if there exists an integer x such that n == 2x.
3
4def isPowerOfTwo(self, n: int) -> bool:
5 return (n != 0) and ((n & (n - 1)) == 0)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected