In this video I explain the algorithm behind solving Leetcode problem #342 Power of Four. Here I find if a number is a power of two as explained in #231 Power of Two (https://youtu.be/PE-kiUrAiAQ), and then I count if it has an even number of zeros to the right of the only set bit.
I am coding in Java since its syntax is easy to understand by all programmers. The algorithms can be applied easily in other languages and most functions that I use have a counterpart in your language of choice.
0:00 Explaining the problem concept
2:39 First coding attempt
6:17 Explaining the problem in the first attempt
7:02 Fixing the problem and reaching an optimal solution
Related Topics: Math, Bit Manipulation