Leetcode: Power of Two Python Solution

Photo by Fotis Fotopoulos on Unsplash

The Question

Input: n = 1
Output: true
Explanation: 20 = 1
Input: n = 16
Output: true
Explanation: 24 = 16
Input: n = 3
Output: false

Approach 1

Approach 2.

1 - 0001 2 - 00103 - 00114 - 01005 - 0101 8 - 100016 - 10000

Software engineer. I write about my journey, Machine Learning, Web application development and also Python!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store