Find if a Number is power of Two

preview_player
Показать описание
JOIN ME
—————

TUTORIALS PLAYLIST
————————————

INTERVIEW PLAYLIST
————————————

Time Lines
=========
0:05 Introduction
0:39 Approach

In this video we will learn how to find the number is power of 2 or not?

This is very easy we can use formula like n&&!(n&(n-1)) and this should give you the result zero if number is power of two.
So we can see that this question can be solved using bit manipulation techniques.

#bitmanipulation #interview #dsa #bits #algorithms
Рекомендации по теме
Комментарии
Автор

Dude explained it, like it was nothing 🔥

enjoythemoment
Автор

doing binary right shift till the first setbit is at 1st position then '|' with '1' will work ???
will it result in same time complexity or MORE ??

manu--gjis