This video explains a very useful programming problem which is to find if a given number is a power of 2.This is very useful in larger codes and also for competitive programming.I have shown 4 methods to solve this problem.The first one is the division method.The second method is based on counting the set bits.The third method is based on finding the first set bit and the fourth method is based on built-in log operation.I have shown the code walkthrough of method 3 and 4 at the end of the video.CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
=================================================================
INSTAGRAM: / surya.pratap.k
LinkedIn: / surya-pratap-kahar-47bb01168
=================================================================
CODE LINK: https://gist.github.com/SuryaPratapK/...
SIMILAR PROBLEM:-
Check if Kth bit is set or not: • Check if Kth bit is set or not
Toggle bits in a given range: • Toggle bits in a given range