Python trick beat 94.66%


  • 1
    S
    class Solution(object):
        def isPowerOfTwo(self, n):
            a={128, 1, 2, 256, 4, 512, 1024, 2048, 8, 4096, 32768, 131072, 524288, 262144, 8192, 2097152, 16, 16384,  4194304, 32, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 1048576, 64,  65536}
            return True if n in a else False
    
    

    Alright, you caught me cheating 乁( ◔ ౪◔)「


  • 0
    S

    You can use this trick in Pow of Three or Four or..... :)


  • 0
    V

    are u serious man lol


  • 0
    S

    @vikram4 it is a true story ⊙ω⊙


Log in to reply
 

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