-
342. Power of Four릿코드(LEETCODE) 2020. 2. 13. 13:10반응형
https://leetcode.com/problems/power-of-four/
4의 제곱수 찾는 문제
(4 * 4 * 4 * 4)
Source
class Solution { public: bool isPowerOfFour(int num) { if (num <= 0) { return false; } if (num == 1) { return true; } while(num != 1) { int cand = num % 4; if(cand) { return false; } num /= 4; } return true; } };
반응형'릿코드(LEETCODE)' 카테고리의 다른 글
53. Maximum Subarray (0) 2020.02.13 392. Is Subsequence (0) 2020.02.13 1290. Convert Binary Number in a Linked List to Integer (0) 2020.02.13 389. Find the Difference (0) 2020.02.13 136. Single Number (0) 2020.02.13