6:09 there is a problem in the written code while loop condition will be (n != 0) instead of (n != 1) if we are using while(n != 1) , then we have to explicitly push back 1 to end of the string after the while loop ends
Already have known these in the past, but after watching this video I was amazed as I had forgotten many things already. It was like having the knowledge for the first time lol.
after completing your amazing dp playlist, now I started this playlist , your voice sound a bit different here 😄 Thanks brother for the amazing content.
I was waiting for this such a long time...Bits manipulation is super fun but was reluctant to learn cos of missing Striver-Factor Well now we have it and the community couldnt be more blessed❤.. Thank u Gurudev apnake onek onek ashirbadh r shubhechaa ❤
At last negation operation part 34:30 onwards So, i think bhaiya got a little confused by that, lemme break it down correctly. so on using the negation operation "~" this simply flips all bits and store the result. nothing much.. just simple flip all bits. Let's work out with case of positive number consider n = 5 = 00000000000000000000000000000101 now, ~n = 11111111111111111111111111111010 this is what is stored inside computer, now upon reading this number when we require it somewhere to be printed or anything. the computer looks at the 31st bit and sees it is set, thus the number is negative, thus a negative sign will be put and now to fetch its value, computer perform 2's complement. So, 00000000000000000000000000000101
At 30:50 when you are taking 2's complement, you are not flipping the signed bit, but at 37:00 , when you are taking 2's complement again in another example, you are flipping the signed bit as well.... please explain , if I am missing something or clear my confusion
There is an error in the code 9:44 it doesn't matter if there is one or not you have to update the value of p2 for (int i = a.length() - 1; i >= 0; i--) { if (a.charAt(i) == '1') { num += p2; } p2 *= 2; }
For INT_MIN you have made the binary as 1(-ve) 0 0 0 ....0 0 0 0 this is representing ZERO not the INT_MIN before calculating two's complement Correct me if i'm wrong
def binary_to_decimal(binary_string): res = 0 base = 1 for i in range(len(binary_string) - 1, -1, -1): num_added = binary_string[i] == "1" res += (base * num_added) base *= 2 return res
this is because the last bit is reserved for the sign bit. Therefore the actual value of the number is the value calculated from the bits excluding the sign bit. Let us assume the number obtained excluding the sign bit is y. We know from the sign bit y is negative. Therefore y is stored as 2's compliment. We take +y (take the 31st bit as 0) then take 1s compliment and add 1 to it. The result becomes the same as shown in the video. Just make sure you don't consider the sign bit in the calculations if it is 1 already.
when doing NOT ,in 2's complement why the sign bit doesn't change? but when we storing negative number, at that time in 2's complement sign bit is changing. can you please clear this? @takeUforward
Striver thank you very much. God bless you ❤ Please could you explain how to rotate number by k steps. K may be less than 0 or greater than 32 If it is < 0 rotate right , if positive rotate left.
hi Striver i have a question 6:25 you were explaining the time complexity of the code log base 2 n but the reverse function will take 0(n) time complexity so eventually the code will take 0(n) or log n?
Respect button for striver bhaiya-->
just striver, dont add bhaiya
need likes huh?
Same guy goes behind shraddha "didi" like a dog😂
He's striver not bhaiya
bhai arrow ke side mai report button aa rha hai ky kru ?? daba du
Respect for this man 💗.......The man who changed the myth DSA is hard
Remember if striver is making than this will be the best bit manipulation playlist on youtube
larn inglis
@@chad._life chal beta aage nikal 😂
Most Awaited Playlist... Bit Manipulation!
6:09 there is a problem in the written code
while loop condition will be (n != 0) instead of (n != 1)
if we are using while(n != 1) , then we have to explicitly push back 1 to end of the string after the while loop ends
I was about to comment the same , good observation :)
I too observed the same.
Yeah
also we can just the concept of indexes and math.pow() function
Yep I also noticed when I coded
Thank you very much striver ,
You are teaching us and working at the same time and too providing us with the best video that to free ,
I'm Grateful.
I was thinking of learning bit manipulation and here you are 🔥
Next, we want strings
@take U forward
Yes we want string
i was the guy who requested striver bhaiya to make playlist on bit manipulation. cheers guys☺
no it was me
nahi me tha mene call kiya tha striver bhai ko playlist ke liye to unhone thik hai upload krta hu bolke upload krdi bit manipulation
@@abhinav6726 hn lekin twitter par maine bola tha
ask him to make on strings
@@soumi6720 bol dunga, but wants to know more about hu
just completed lt1 now moving on to the 2nd one.
a big thanks to you bhaiya.
Thanks a lot striver for your great effort!!! In this video 13 played a hero role...
Thank you so much striver, you have changed my mind about coding
Already have known these in the past, but after watching this video I was amazed as I had forgotten many things already. It was like having the knowledge for the first time lol.
Truly appreciate this content. I finally get to understand bit manipulation
This playlist helps us to learn bit manipulation
no shit
Thank you Striver for this Amazing Playlist....😊
Actually I have done all questions of bit Manipulation from ATOZ DSA sheet but still watching for one and only striver bhaiya
Legend is back🔥
Finally Bit Manipulation 🎉
Thank You Bhaiya ❤
most awaited series Mann! you are great
i am appreciating your effort
also make playlist for greedy and stack & queues
I wonder my dsa, if Striver Sir weren't in youtube.Thanku Sir.
after completing your amazing dp playlist, now I started this playlist , your voice sound a bit different here 😄
Thanks brother for the amazing content.
Hey bro just one request from my side is please try to complete whole sheet as soon as possible the sheet is legendary thanks again for giving it free
i am so happy .. keep doing hard work
for those who have confusion on negative numbers, revisit this 25:34
concepts are cleared❤❤
thank you striver Bhaiya❤
a perfect lecture for intro of bit.
Thank You So Much for this wonderful video.........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
Finally learned this stuff after avoiding it for so long
Waiting from 2 months for this playlist.
Thank you striver, and now only I think strings playlist is balance
Understood,thanks striver for this amazing video.
That really cleared my fear of Bits . Thank u .
wow after long time _new Playlist is coming, sir can you make a playlist on "Two pointer"....Thank you❤❤❤❤
finally!!!!!!!!!!! can't be more happy ❤🔥❤🔥❤🔥❤🔥❤🔥
Yaaaay... Finally Bit Manipulation... Ab lagegi job sbki
Trick for 2s compliment in O(n)
Start from end, the moment you encounter 1, you start flipping the bits that appear after it.
Bas ab String or Heaps reh gya 😊 jaldi complete kardo bhaiya inhe v
East or West Striver bhaiya is best 💯
I was waiting for this such a long time...Bits manipulation is super fun but was reluctant to learn cos of missing Striver-Factor
Well now we have it and the community couldnt be more blessed❤.. Thank u Gurudev apnake onek onek ashirbadh r shubhechaa ❤
At last negation operation part 34:30 onwards
So, i think bhaiya got a little confused by that, lemme break it down correctly. so on using the negation operation "~" this simply flips all bits and store the result. nothing much.. just simple flip all bits.
Let's work out with case of positive number
consider
n = 5 = 00000000000000000000000000000101
now,
~n = 11111111111111111111111111111010
this is what is stored inside computer, now upon reading this number when we require it somewhere to be printed or anything. the computer looks at the 31st bit and sees it is set, thus the number is negative, thus a negative sign will be put and now to fetch its value, computer perform 2's complement. So,
00000000000000000000000000000101
Thanks a lot for this detailed explanation man
Thanks a lot bro. This cleared all my confusion!
thank you so much
these lectures are so so good
Thank you so much Striver 😭😭
At 30:50 when you are taking 2's complement, you are not flipping the signed bit, but at 37:00 , when you are taking 2's complement again in another example, you are flipping the signed bit as well.... please explain , if I am missing something or clear my confusion
He made a mistake it Just flips either way even if it is positive or negative
Thank you very much for your dedication
Was eagerly waiting for the video
Sir plz make playlist on sliding window
comeback shuru
Thank you for this series🙏🙏
thank you 😊
Bhai while loop ki condition alg ayge :
while(n>0) hoga
thank you so much for this course, we know that the course is probably draining you, as is visible from your face so pls take rest when you need to
Great Content !, Can you extend this playlist by adding bitmask and bitmask DP? Thank you!
There is an error in the code 9:44 it doesn't matter if there is one or not you have to update the value of p2
for (int i = a.length() - 1; i >= 0; i--) {
if (a.charAt(i) == '1') {
num += p2;
}
p2 *= 2;
}
Waiting for String playlist
At 5:27 n!=1 is wrong n!=0 is correct
Starting today: 10th August 2024.
Great job bhai.
For INT_MIN you have made the binary as 1(-ve) 0 0 0 ....0 0 0 0 this is representing ZERO not the INT_MIN before calculating two's complement
Correct me if i'm wrong
def binary_to_decimal(binary_string):
res = 0
base = 1
for i in range(len(binary_string) - 1, -1, -1):
num_added = binary_string[i] == "1"
res += (base * num_added)
base *= 2
return res
36:13 why sign bit doesnt effect by complement
same doubt for me also
this is because the last bit is reserved for the sign bit. Therefore the actual value of the number is the value calculated from the bits excluding the sign bit. Let us assume the number obtained excluding the sign bit is y. We know from the sign bit y is negative. Therefore y is stored as 2's compliment. We take +y (take the 31st bit as 0) then take 1s compliment and add 1 to it. The result becomes the same as shown in the video. Just make sure you don't consider the sign bit in the calculations if it is 1 already.
@@kushgupta6892 really?
THANK YOU STRIVER...🙂
Thank youu STRIVER💃
Wait is over 🥳🥳🥳🥳
Thanks and I promise I will finish by tommorow
did you?
@@Monika-vs6bw yup done ..
Understood
Kindly bring entire Bit Manipulation in 1 GO.
when doing NOT ,in 2's complement why the sign bit doesn't change? but when we storing negative number, at that time in 2's complement sign bit is changing. can you please clear this? @takeUforward
I really like this man
Thalaivaaa❤
Lots Lots Lots of Love 🤟
for both positive and negative in case of not we have to do 2's compliment
Strings (hard problems) ka video solutions or Articles add kardo bhaiya ❤
Much needed one
Much needed topic 😅
Striver thank you very much. God bless you ❤
Please could you explain how to rotate number by k steps. K may be less than 0 or greater than 32
If it is < 0 rotate right , if positive rotate left.
Understood. Thank you!
Respect ❤
Love you Bhai so much❤
UNDERSTOOD!!
thank you striver
Thank you bhaiya
what happen to string module which was before linkedlist??
Thanks a lot Bhaiya
Many many thanks
100th like from me was my pleasure ❤
there is a mistake in 4:42 "number to binary" code -> if(n!=1) => you are leaving the last 1 after the division.
it should be -> if(n!=0)
Waiting for more lec plz complete it asap plzzzzzzzz
Thank you sir
understood ❤
Respect !!!!!!!!!!!!!!!!!!!!
Striver is going to destroy the dsa market by giving High level of free content 😂
hi Striver i have a question 6:25 you were explaining the time complexity of the code log base 2 n but the reverse function will take 0(n) time complexity so eventually the code will take 0(n) or log n?
Thank you very much
Respect !
Understood!!!
please make string series next
tysm sir
A2Z sheet is not updated with notes and video links for bit manipulation.