Power of Two | Check if a number is Power of Two | Bit Manipulation Interview Questions

  Рет қаралды 19,444

Pepcoding

Pepcoding

Күн бұрын

Пікірлер: 41
@PankajYadav-kf4qf
@PankajYadav-kf4qf 4 жыл бұрын
Sir you are doing great job for students those who can't afford online courses.I hope that your channel will grow fast
@WhATtHeFOX-qg2ig
@WhATtHeFOX-qg2ig 3 ай бұрын
After getting worried for 30 mins..... finally got an amazing explanation..
@vbv.bhardwaj
@vbv.bhardwaj 10 ай бұрын
left shift dekne aay atha bs pe itna sb btadia, tq bro
@kanhamishra1630
@kanhamishra1630 4 жыл бұрын
A serious request to everyone who comments.. Please ask doubts.. You know it is a huge blessing to have Sumeet Sir guiding like this.. Please share the channel.. It's a request from me, one of his student.. Sir will also feel motivated to upload new new content everyday then.
@Pepcoding
@Pepcoding 4 жыл бұрын
i am always motivated for this
@0_0-0_0.
@0_0-0_0. 3 жыл бұрын
bhai jisne bhi dislike kiya hai o bilkul nark jayega. itni golden content pe dislike koun karta hai yar. thank you o much sir for this great content.
@Pepcoding
@Pepcoding 3 жыл бұрын
Haha Glad to know that you liked the content and thank you for appreciating. The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos. So, keep motivating, keep learning and keep loving Pepcoding😊
@deepak-pb2xt
@deepak-pb2xt 9 ай бұрын
0 is the exception. Well, great content tbh. tysm
@faizan346
@faizan346 3 жыл бұрын
one correction it will give true even if the number is n = 0, which is not the power of 2 so, return (x && !(x&(x-1))); this will check for 0 and power of 2.
@ritiktwopointo2691
@ritiktwopointo2691 4 жыл бұрын
bits manipulation is really maical :) thanks again sir
@Pepcoding
@Pepcoding 4 жыл бұрын
ji, padhte rahie. aj se level2 ki dp start hogi
@anjandey6089
@anjandey6089 3 жыл бұрын
we have to add this condition also; if(n==0) System.out.println("NO);
@GhostKiller9100
@GhostKiller9100 3 жыл бұрын
thank you
@ayushgoel9584
@ayushgoel9584 4 жыл бұрын
Sir completed 30 questions of dp foundation today, alag level ka confidence aa rha hai sir, Mazza alag aa rha hai pehli Baar padne mein, meine toh Apne next 4-5month pepcoding ke Naam kar diye, job thoda late kar lenge(2020 passout)
@Pepcoding
@Pepcoding 4 жыл бұрын
aj se level2 ki DP shuru hogi. usko bhi kijie. usme 120-170 ques daalunga. uske baad DP kabhi preshan nahi karegi, kahin ki bhi ho.
@ayushgoel9584
@ayushgoel9584 4 жыл бұрын
@@Pepcoding sir mera foundation ka graphs reh gya Abhi, toh usko Baad mein Karoo, pehle level2 ki dp start kar do, graphs ki jaroorat toh nhi padegi Abhi dp mein
@Pepcoding
@Pepcoding 4 жыл бұрын
nhi nhi nhi. graphs to abhi karo, levelup ki dp mei shuru mei he graph use hoga.
@shivasharma1774
@shivasharma1774 4 жыл бұрын
what is DP?? 🙄
@aman6561
@aman6561 4 жыл бұрын
@@shivasharma1774 Dynamic programming
@Abhishekkumarnjw22-vf7cr
@Abhishekkumarnjw22-vf7cr 4 ай бұрын
Outstanding
@vedantagarwal22
@vedantagarwal22 3 жыл бұрын
Great explanation sir , in all videos , thankyou !!!
@creativeeducator42
@creativeeducator42 25 күн бұрын
Thankyou Sir ❤️
@shubhamsood1406
@shubhamsood1406 4 жыл бұрын
Another approach is to count Set Bit and if set bit == 1, then it is a power of 2 else not a power of 2.
@suyashlale7315
@suyashlale7315 2 жыл бұрын
but that would be O(log n) instead of O(1).
@rohita6532
@rohita6532 Жыл бұрын
@@suyashlale7315 just removing rmsb will also work, if it becomes zero it's true but in both approaches, we should check if the given number is zero or not if it is zero both approaches give true but it is not so a simple check in the starting would work there
@ShubhamKumar-km8pm
@ShubhamKumar-km8pm Жыл бұрын
Thanks sir🔥
@anishchauhan2647
@anishchauhan2647 3 жыл бұрын
thanks sir this helps me a lot
@AkashGupta_youtube
@AkashGupta_youtube 2 жыл бұрын
this logic is not working for 0
@rahulbhatia3075
@rahulbhatia3075 4 жыл бұрын
Good explanation 🔥
@Pepcoding
@Pepcoding 4 жыл бұрын
Padhte rahie
@nishthagoyal5018
@nishthagoyal5018 4 жыл бұрын
Thankyou sir
@thakurjigupta1093
@thakurjigupta1093 3 жыл бұрын
n=0 dalne vala case kaise handle kare
@kushaldulani
@kushaldulani 4 жыл бұрын
Sir aapke yaha offline classes kab start hone k plan he ? Live me vo maja nahi jo aapke yaha delhi me center me padhne ka he
@Pepcoding
@Pepcoding 4 жыл бұрын
hum to bilkul chahte hain par jab tak government allow nahi karegi, tab tak kya karein
@mickyman753
@mickyman753 3 жыл бұрын
rightmost set bit minus krne pr 0 ho jae toh power of two
@bradbale1510
@bradbale1510 4 жыл бұрын
Sir, im from mech branch. I've switched my career direction to IT and i am following pepcoding. Currently in 4th yr, unable to handle college subjects and minor project and coding together. was thinking to drop out(but bina degree ke job nahi), so just seeking suggestion as what to do? :)
@Pepcoding
@Pepcoding 4 жыл бұрын
bro, degree lelo jaise taise. System se itni ladai na karo. Ek cheez ka vishwash dilata hun, agar tumne 4th year mera sara youtube content kar lia to tumhe amazon mei place karana mai apni zimmedaari samjhunga. Aise ek DTU ka civil ka bacha amazon mei place kra chuke hain hum. Pepcoding ka sara youtube chaat jao, usme DS bhi ho jaegi, CORE bhi aur computer science ke projects bhi.
@bradbale1510
@bradbale1510 4 жыл бұрын
@@Pepcoding Thank you for showing me the way Sir. I cant thank you enough
@jitenderyadav721
@jitenderyadav721 4 жыл бұрын
Sir apka code 0 ke liye fail ho jata hai Aur na hi apke test case me voh pakdta hai 0 wale case ko
@Pepcoding
@Pepcoding 4 жыл бұрын
beta daal dete hain
@Kaafirpeado54-6ayesha
@Kaafirpeado54-6ayesha Ай бұрын
Thanks from kaafir 🙏
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 42 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 25 МЛН
Power of 2 | Leetcode #231 | 4 methods explained
10:17
Techdose
Рет қаралды 40 М.
Find if a Number is power of Two
4:45
CppNuts
Рет қаралды 6 М.
Easy Google Coding Interview With Ben Awad
28:00
Clément Mihailescu
Рет қаралды 1 МЛН
«Если 50 детей не рожу - ничего не добился»
1:26:17
Саша Сулим
Рет қаралды 1,9 МЛН
L8. XOR of Numbers in a Given Range | Bit Manipulation
9:38
take U forward
Рет қаралды 49 М.
Check if a given number is a power of 2 | Java
6:11
B Tech Computer Science
Рет қаралды 8 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 754 М.
L4. Power Set | Bit Manipulation
12:38
take U forward
Рет қаралды 72 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 42 МЛН