Skip to content

Commit 1601e8b

Browse files
committed
Day 4 - Power of Four
1 parent fbb5eee commit 1601e8b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

4-power-of-four.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -------------------------------------------------------
2+
# Power of Four - https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/549/week-1-august-1st-august-7th/3412/
3+
# -------------------------------------------------------
4+
# Author: Arshad Mehmood
5+
# Github: https://github.com/arshad115
6+
# Blog: https://arshadmehmood.com
7+
# LinkedIn: https://www.linkedin.com/in/arshadmehmood115
8+
# Date : 2020-08-4
9+
# Project: leetcode-august-2020
10+
# -------------------------------------------------------
11+
from math import log
12+
13+
class Solution:
14+
def isPowerOfFour(self, num: int) -> bool:
15+
return num >= 1 and log(num, 4).is_integer()
16+
17+
solution = Solution()
18+
result = solution.isPowerOfFour(4)
19+
print(result)
20+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ My leetcode profile can be viewed [here](https://leetcode.com/arshad115/)
99
| 1 | [Detect Capital](./codes/1-detect-capital.py) |
1010
| 2 | [Design Hashset](./codes/2-design-hashset.py) |
1111
| 3 | [Valid Palindrome](./codes/3-valid-palindrome.py) |
12+
| 4 | [Power of Four](./codes/4-valid-palindrome.py) |

0 commit comments

Comments
 (0)