<filename>Python/June Challenge/08_PowerOfTwo.py
## Power of Two
#  https://leetcode.com/explore/challenge/card/june-leetcoding-challenge/540/week-2-june-8th-june-14th/3354/
#
# ---
#
#### Problem Statement:
# 
# Given an integer, write a function to determine if it is a power of two.
#
#### Example:
#
# ```
# Input: 1
# Output: true
# Explanation: 20 = 1
#
# Input: 16
# Output: true
# Explanation: 24 = 16
#
# Input: 218
# Output: false
#

class Solution:
    def isPowerOfTwo(self, n: int) -> bool:
        if n <= 0:
            return False;
        return (n&(n-1))==0

<filename>Python/June Challenge/08_PowerOfTwo.py
## Power of Two
#  https://leetcode.com/explore/challenge/card/june-leetcoding-challenge/540/week-2-june-8th-june-14th/3354/
#
# ---
#
#### Problem Statement:
# 
# Given an integer, write a function to determine if it is a power of two.
#
#### Example:
#
# ```
# Input: 1
# Output: true
# Explanation: 20 = 1
#
# Input: 16
# Output: true
# Explanation: 24 = 16
#
# Input: 218
# Output: false
#

class Solution:
    def isPowerOfTwo(self, n: int) -> bool:
        if n <= 0:
            return False;
        return (n&(n-1))==0

## Power of Two #  https://leetcode.com/explore/challenge/card/june-leetcoding-challenge/540/week-2-june-8th-june-14th/3354/ # # --- # #### Problem Statement: # # Given an integer, write a function to determine if it is a power of two. # #### Example: # # ``` # Input: 1 # Output: true # Explanation: 20 = 1 # # Input: 16 # Output: true # Explanation: 24 = 16 # # Input: 218 # Output: false #