-
25. Power of FourProblem Solving 2022. 9. 15. 04:21728x90
https://leetcode.com/problems/power-of-four/
Power of Four - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
4의 제곱수가 맞는지 boolean으로 출력하는 문제
class Solution: def isPowerOfFour(self, n: int) -> bool: if n < 1: return False elif n == 1: return True while n > 1: if n % 4 != 0: return False n = n // 4 return True
살짝 까다로운 듯했으나 금방 풀 수 있었던 문제
'Problem Solving' 카테고리의 다른 글
27. 큰 수 만들기 (2) 2022.09.19 26. 하샤드 수 (4) 2022.09.16 24. Lemonade Change (0) 2022.09.14 23. Add Digits (2) 2022.09.13 22. 핸드폰 요금 (0) 2022.09.12