Swift solution


  • 0
    class Solution {
        func isPowerOfFour(_ num: Int) -> Bool {
            return num > 0 && (num & (num - 1)) == 0 && (num - 1) % 3 == 0
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.