Python 1-line works for arbitrary large number


  • 1
    class Solution(object):
        def isPowerOfFour(self, num):
            return num & num - 1 == 0 and (num - 1) % 3 == 0

Log in to reply
 

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