What do you think about this approach?: make a lookup table for all powers of four!

  • 1

    Re: fastest C++ code
    A fellow coder, made a switch/case clause and switched between all possible powers of four. For a 32 bits integer, there are only 16 of them! Personally I think this is the correct way of checking if a number is power of four, if our code is assumed to be run millions of times and performance matters. What are your thoughts?

Log in to reply

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