L2. Must Know Tricks in Bit Manipulation | Swap two numbers without third variable

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

ความคิดเห็น • 191

  • @modiji8706
    @modiji8706 10 หลายเดือนก่อน +248

    1. Swap two numbers - 00:00
    2. Check if ith bit is set or not - 3:47
    3. set ith Bit - 10:47
    4. clear ith Bit - 14:27
    5. Toggle ith Bit - 17:52
    6.Remove the last set Bit - 21:23
    7. Check if a number is power of 2 or not - 28:26
    8.count the number of set bits - 31:24

    • @NAMAN-wj7dj
      @NAMAN-wj7dj 10 หลายเดือนก่อน +27

      thanku modi ji ! abki baar 400 paar 👍

    • @modiji8706
      @modiji8706 10 หลายเดือนก่อน +15

      @@NAMAN-wj7dj Vote dena mt bhulna Abki baar Modi Sarkar

    • @02deepak
      @02deepak 9 หลายเดือนก่อน +9

      @@modiji8706 modi ji wo recession ka kuch hojata toh badhiya maan lgta voting m

    • @himanshutiwari6614
      @himanshutiwari6614 9 หลายเดือนก่อน +5

      ​@@02deepakmodiji khud pdh rhe hai dsa😅

    • @modiji8706
      @modiji8706 9 หลายเดือนก่อน +8

      RastraPati Bhawan ma A jao kl ispe wartalap krte hai

  • @Noob_Coder1234
    @Noob_Coder1234 11 หลายเดือนก่อน +157

    REMEMBER IF STRIVER IS MAKING , THEN IT WILL BE THE BEST PLAYLIST ON BIT MANIPULATION

    • @siddiqabr7110
      @siddiqabr7110 3 หลายเดือนก่อน

      Have you ever watched kunal kushwaha's videos

    • @aayambhatt5363
      @aayambhatt5363 3 หลายเดือนก่อน +1

      @@siddiqabr7110 his videos arent any good

    • @mayankagarwal6775
      @mayankagarwal6775 3 หลายเดือนก่อน

      @@aayambhatt5363 yes !! I had started my dsa journey from kunal but now shifted to striver after understanding basics of dsa.

    • @lillyput2275
      @lillyput2275 2 หลายเดือนก่อน

      @@aayambhatt5363I don’t understand his way of teaching

    • @CDK-Tech
      @CDK-Tech 2 หลายเดือนก่อน

      @@aayambhatt5363 His videos was once good , now it's not 😭

  • @fazfavas-d6j
    @fazfavas-d6j 11 หลายเดือนก่อน +43

    Never seen better teacher than u

    • @Benstokes555
      @Benstokes555 10 หลายเดือนก่อน

      YESS

    • @raorao7329
      @raorao7329 7 หลายเดือนก่อน

      true

  • @roshankumar280
    @roshankumar280 7 หลายเดือนก่อน +46

    One-Liner:
    1) Swapping Two Numbers : Num1=(Num1^Num2);
    Num2=(Num1^Num2);
    Num1=(Num1^Num2);
    2) Check If i’th bit is set or not: if((Num&(1

    • @Monjaverse
      @Monjaverse 4 หลายเดือนก่อน

      Love you bro ❤❤❤

  • @SuvradipDasPhotographyOfficial
    @SuvradipDasPhotographyOfficial 7 หลายเดือนก่อน +19

    Awesome Striver, done with sliding window and two pointers and now started with bit manipulation yesterday

  • @uzzal.cse42
    @uzzal.cse42 4 หลายเดือนก่อน +4

    Crystal clear explanation. Highly recommended for those who does not know anything about bit manipulation.

  • @SumitKumar-qg4ps
    @SumitKumar-qg4ps 10 หลายเดือนก่อน +9

    to clear ith bit(0 indexed), we can just do
    N = n xor (1

    • @chickukoshti3741
      @chickukoshti3741 10 หลายเดือนก่อน +1

      toggle

    • @AnushkaMishra8
      @AnushkaMishra8 10 หลายเดือนก่อน +3

      Yes , but it will work same as toggling if the bit is not set and we don't want that , if the bit will be 0 then also it will be changed to 1 if we do this.

    • @HaamroNotes
      @HaamroNotes 8 หลายเดือนก่อน

      @@AnushkaMishra8 yeah bro

  • @nguyengiahuy6292
    @nguyengiahuy6292 11 หลายเดือนก่อน +15

    struggling so much with this topic alone. Thank you for the series!!!!

  • @AdityaSharma-er3gs
    @AdityaSharma-er3gs 7 หลายเดือนก่อน +12

    33:00 here you can simply do this
    public static int countSetBit(int num){
    int count = 0;
    int one = 1;
    while(num > 0){
    if((num & one) == 1){
    count++;
    }
    num = num >> 1;
    }
    return count;
    }

    • @priyanshugupta7840
      @priyanshugupta7840 หลายเดือนก่อน

      it is almost the same thing taking the same time except you create one more variable num ;)

  • @tgayush1424
    @tgayush1424 7 หลายเดือนก่อน +6

    amazing video covering all concepts, soon will be mastering bit manipulations by completing your playlist.Before i used to be scared of seeing bits but now it's easy , even i started to use , today i used in one question and solved that question easily.

  • @knowthrvdo
    @knowthrvdo 11 หลายเดือนก่อน +4

    Thanks for starting uploading again it is very helpful for us.

  • @bhushandharne8827
    @bhushandharne8827 10 หลายเดือนก่อน +4

    Sir, Your Techniques are superb

  • @codingp110
    @codingp110 7 หลายเดือนก่อน +4

    Best Bit Manipulation tutorial ever!!!

  • @ankushrai3155
    @ankushrai3155 17 วันที่ผ่านมา

    the efforts this guy puts is just amazing

  • @KaushalDhruw
    @KaushalDhruw 9 หลายเดือนก่อน +3

    before this I thought I knew bitwise operations. But the tricks you've shown are awesome. Thanks again.

  • @udayshankar-e6v
    @udayshankar-e6v 11 หลายเดือนก่อน +5

    Many times I thought to comment on his post and lastly just leaving it by pressing like button.. thinking that kya kya bolega log,,! Is there anyone else like me ? Aisa koi h Banda Jo striver se bhi accha padhata ho ! I don't think so some one exist ❤

    • @pranavmittal9619
      @pranavmittal9619 11 หลายเดือนก่อน

      ek h lekin me nahi batunga bas hint de deta hu : 2 crore ka package chod diya bande ne

    • @udayshankar-e6v
      @udayshankar-e6v 11 หลายเดือนก่อน

      ​@@pranavmittal9619Bhai hai to bata do jara hum bhi Jane kon h, teacher hi na , terrorist thode h Jo bata na paoge 😂 kahi tum hi to nahi ho wo 2 cr vala Banda Jo chhup chup ke bit manipulation ka maja le rahe ho😊

    • @raorao7329
      @raorao7329 7 หลายเดือนก่อน

      @@pranavmittal9619 who??

    • @pranavmittal9619
      @pranavmittal9619 7 หลายเดือนก่อน

      @@raorao7329 bhai coder army wale rohit negi bhaiya hai hindi lanuage ke liye bas striver best hai lekin Full english me concept grasp karne me dikkat bhi aati hai or striver ka code high level ka rehta hai or rohit negi ka low level ka code lekin output same rehta

  • @coderspathway
    @coderspathway 9 หลายเดือนก่อน +16

    I have paid DSA course from GFG.
    But not able to understand BIT manipulation.
    After watching this playlist by striver I feel the striver did it better than any other paid course in the market.

    • @Thinker-360
      @Thinker-360 8 หลายเดือนก่อน +5

      same here i paid for my gfg self paced but i'm now watching strivers youtube to solve DSA

  • @Karanssharma03
    @Karanssharma03 8 หลายเดือนก่อน +4

    i dont know how to say thank you but you saved me striver . thank you>3000

  • @rishavjain5087
    @rishavjain5087 16 วันที่ผ่านมา

    This is just too good to be true bro..
    Thanks a lot❤

  • @tamannaverma4178
    @tamannaverma4178 11 หลายเดือนก่อน +8

    Thanks for all these efforts :)

    • @ce038_divanshsingh3
      @ce038_divanshsingh3 7 หลายเดือนก่อน

      i just stuck to your glow in comment section 😂😂 , forgot about the lecture that is running in the background ..

  • @stith_pragya
    @stith_pragya 9 หลายเดือนก่อน +3

    Understood....Thank You So Much for this wonderful video.........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @TejeshReddyThippakkagari
    @TejeshReddyThippakkagari 10 หลายเดือนก่อน +1

    Thanks for teaching every possibility answer for the problems❤❤❤

  • @kbsce
    @kbsce 8 หลายเดือนก่อน +1

    Neatly, clearly explained which anyone can easily understand 😊really appreciated your efforts😊

  • @SaswataMaitra
    @SaswataMaitra 3 หลายเดือนก่อน

    17:20 another approach (n&(INT_MAX^(1

  • @harshverma9675
    @harshverma9675 6 วันที่ผ่านมา

    Bhai aapka knowledge toh kamal ka hai bhai.

  • @rohan8758
    @rohan8758 4 หลายเดือนก่อน

    *java code*
    Set ith bit from last, conside 0 based indexing (10:47 ):
    public static void main(String[] args) {
    int n = 9;
    int k = 2;
    int second_desired_num = 1

  • @KapilSharma56419
    @KapilSharma56419 7 หลายเดือนก่อน +4

    there is a question on GFG : Count total set bits You are given a number N. Find the total count of set bits for all numbers from 1 to N(both inclusive).
    which shows TLE by all your methods can you please explain it .

  • @momentcoder
    @momentcoder 23 วันที่ผ่านมา

    The best teacher for dsa 🔥🔥

  • @JIHYELEE-h2m
    @JIHYELEE-h2m 6 หลายเดือนก่อน

    Wow this is essence of bit manipulation!!!!!!!!!! Thank you so much

  • @leaguesonu9354
    @leaguesonu9354 10 หลายเดือนก่อน +1

    hats off man for your hardwork

  • @rahuljain224
    @rahuljain224 9 หลายเดือนก่อน +1

    Salute to your hardwork and explanation

  • @SamirKumarRakshit-c4z
    @SamirKumarRakshit-c4z 5 หลายเดือนก่อน +1

    int count = 0;
    int num = 7;
    while(num > 0){
    num = (num & (num-1));
    ++count;
    }
    print(count)
    We can also do this in order to count the set bit (1)😊

  • @tapasyadimree9651
    @tapasyadimree9651 9 หลายเดือนก่อน +9

    17:20 when finding ~(1

    • @GoluKumar-sb2si
      @GoluKumar-sb2si 8 หลายเดือนก่อน +1

      same doubt bro

    • @AkOp-bf9vm
      @AkOp-bf9vm 8 หลายเดือนก่อน

      i think we cannot access 2's complement part and can only access negated part of the number maybe i am not sure

    • @CodeByRobin
      @CodeByRobin 4 หลายเดือนก่อน

      same doubt bro ,, I raised this on lecture one as well, but bhaiya is not replying....

  • @akashddeepchitransh4537
    @akashddeepchitransh4537 2 หลายเดือนก่อน

    Knowledge Packed Lecture.

  • @nashalafroz
    @nashalafroz 10 หลายเดือนก่อน +4

    17:30 sir if we use not operator wouldnt the number converted into its 2's complement

    • @janarddansarkar2694
      @janarddansarkar2694 10 หลายเดือนก่อน

      same doubt. Someone please clearify

    • @janarddansarkar2694
      @janarddansarkar2694 10 หลายเดือนก่อน

      What I am assuming is since we are not storing the negative answer, so 2's complement is not used. If the answer was negative, then to store it, 2's complement would have been used. This is my assumption though. Not sure

    • @human0225
      @human0225 10 หลายเดือนก่อน

      Any solution to this I am still struggling with this.

    • @kumarnishantnitallahabad160
      @kumarnishantnitallahabad160 9 หลายเดือนก่อน

      same doubt

    • @CodeByRobin
      @CodeByRobin 4 หลายเดือนก่อน

      Same doubt .. You got the answer.

  • @rithish993
    @rithish993 6 หลายเดือนก่อน +1

    17:30 instead we can left shift 1 and use xor operators

  • @lakshmanlk977
    @lakshmanlk977 9 หลายเดือนก่อน +1

    Ohh striver such an amazing lecture ..

  • @anshrathore2731
    @anshrathore2731 11 หลายเดือนก่อน +1

    Thank you so much BHAIYA 🙏🙏🙏

  • @ishwarreddy8820
    @ishwarreddy8820 10 หลายเดือนก่อน

    If striver is making then it will be the best playlist ;

  • @UECAshutoshKumar
    @UECAshutoshKumar 10 หลายเดือนก่อน +1

    Thank you sir 🙏

  • @DeepakKumar-nq4td
    @DeepakKumar-nq4td 5 หลายเดือนก่อน

    Hila diye bhaiya ji 🎉🎉🎉❤❤

  • @padduchennamsetti6516
    @padduchennamsetti6516 4 หลายเดือนก่อน +1

    understood ,thanks alot

  • @Sahilkumar-hj4vm
    @Sahilkumar-hj4vm 6 หลายเดือนก่อน

    at 17:30 striver do the NOT operator and it flipped all the bits making it a negative number then according to full NOT operator it do 2's complement also but striver stopped at flipping can someone explain me why?
    edited - ok i get it why computer store binary as flipped but while showing us it do 2's complement to show us -ve binary in interger

  • @veerverma5586
    @veerverma5586 11 หลายเดือนก่อน +3

    Keep going 🏆

  • @mordernmonk194
    @mordernmonk194 3 หลายเดือนก่อน +1

    One-Liner:
    1) Swapping Two Numbers :
    Num1=(Num1^Num2);
    Num2=(Num1^Num2);
    Num1=(Num1^Num2);
    0000101 = num1
    ^0001001 = num2
    ________
    0001100 xor of num1 and num2 stored in num1
    0001001 = num2
    -----
    0000101 xor of (num1 and num2) and num2 stored in num2
    0001100
    -----
    0001001
    2) Check If i’th bit is set or not: if (( Num &(1

  • @ShravanKumar-wg9pv
    @ShravanKumar-wg9pv 2 หลายเดือนก่อน

    W lecture. Thank you very much sir.

  • @itxamanpanwar8556
    @itxamanpanwar8556 7 หลายเดือนก่อน

    🙏🙏TQ bhaiya for such a good explanation is topic ma smj hi ni aa raaha tha ab sb easy lg r ha

  • @andrewcenteno3462
    @andrewcenteno3462 6 หลายเดือนก่อน

    This course was insanely good

  • @PavanKumar-jz5ow
    @PavanKumar-jz5ow 3 หลายเดือนก่อน

    UNDERSTOOD 🎉🎉😁😁😁😁

  • @aryansinha1818
    @aryansinha1818 3 หลายเดือนก่อน

    38:00 around, using the last method

  • @abhinavraj6507
    @abhinavraj6507 5 หลายเดือนก่อน

    At 17:20 striver is not taking 2's complement for NOT operator ?
    Last video he taught that if after flipping the number becomes negative , we take 2's complement , anyone please help ?

    • @CodeByRobin
      @CodeByRobin 4 หลายเดือนก่อน

      same doubt. Please let me know, if you got the answer

  • @Benstokes555
    @Benstokes555 10 หลายเดือนก่อน

    MY MAN IS BACKKKKKKKKKK

  • @ryugagaming195
    @ryugagaming195 11 หลายเดือนก่อน +2

    Sir plz make more videos on sliding window

  • @sakshikatiyar5353
    @sakshikatiyar5353 10 หลายเดือนก่อน

    u are the best teacher

  • @ganeshjaggineni4097
    @ganeshjaggineni4097 3 หลายเดือนก่อน

    NICE SUPER EXCELLENT MOTIVATED

  • @CodewithAnuragBassu
    @CodewithAnuragBassu 11 หลายเดือนก่อน

    Thanku so much bhaiya❤❤🙏🙏🙏🙏

  • @MuraliVardhan-s4s
    @MuraliVardhan-s4s หลายเดือนก่อน

    thank you anna🧡

  • @uditgarg6508
    @uditgarg6508 7 หลายเดือนก่อน

    for checking ith bit set
    just do right shift by ith and check the resukting num is odd. if it is , it is set. else , not ...

  • @edsongeorgerebello547
    @edsongeorgerebello547 หลายเดือนก่อน

    In the clearing the set bit won't the negation of the left shift 1 make it a 2's complement and the program will add a 1 to it ?

  • @utkarshtiwari7500
    @utkarshtiwari7500 6 หลายเดือนก่อน +3

    To clear ith bit we can do :-
    return ( n ^ (1

    • @shivanshpatel1898
      @shivanshpatel1898 6 หลายเดือนก่อน +4

      no we cant because 0 ^ 1 is 1 so if ith bit is already zero it will change it to 1

    • @JunaidhFardeen
      @JunaidhFardeen 3 หลายเดือนก่อน +2

      It is for toggle

  • @ReNaq313
    @ReNaq313 9 หลายเดือนก่อน

    39:00 -> repeatedly removing the rightmost set bits and taking the count of times we did this operation would give us the number of set bits in a number

  • @CodeByRobin
    @CodeByRobin 4 หลายเดือนก่อน

    somewhere in the comments , i read
    "computer store binary as flipped but while showing us it do 2's complement to show us -ve binary in interger"
    is this right?

  • @AKSHATMEENA-d9c
    @AKSHATMEENA-d9c 2 วันที่ผ่านมา

    awesome video sir

  • @vijeshsshetty
    @vijeshsshetty 10 หลายเดือนก่อน +1

    thank you sir ji

  • @SHINGAVIKAJAL
    @SHINGAVIKAJAL 9 หลายเดือนก่อน +2

    super amazing!!

  • @cleweric
    @cleweric 6 หลายเดือนก่อน

    in case of power of 2, n & (n-1) == 0 will not work if n = 0, as 0 is not a power of two, we can rather use n & (-n) == n, which mean AND n with its 2's complement it would result n, if its a power of 2

  • @Josuke217
    @Josuke217 5 หลายเดือนก่อน

    Great lecture.

  • @karthik-varma-1579
    @karthik-varma-1579 3 หลายเดือนก่อน +1

    Set> Or
    Clear/Remove -> And
    Toggle -> Xor

  • @riachoudhary__
    @riachoudhary__ 10 หลายเดือนก่อน

    Thank you for making this video

  • @anantmishra5174
    @anantmishra5174 8 วันที่ผ่านมา

    I HAVE ONE QUESTION WHEN WE ARE CHECKING IF I'th BIT IS SET OR NOT WHILE DOING RIGHT SHIFT OF NUMBER (n-1) TIMES. WOULDN'T IT CHANGES THE INPUT NUMBER SUPPLIED.

  • @music-loverFam
    @music-loverFam 5 หลายเดือนก่อน

    Understood😊

  • @swaroopvengali
    @swaroopvengali 5 หลายเดือนก่อน

    Python 1 liners-
    =============
    Swapping two numbers: a = a ^ b; b = a ^ b; a = a ^ b
    Check if i'th bit is set or not: print("SET" if (Num & (1

  • @DeepakPatel-d5v
    @DeepakPatel-d5v 9 หลายเดือนก่อน +1

    Thanks a lot Bhaiya

  • @thaman701
    @thaman701 10 หลายเดือนก่อน

    Great sir.❤

  • @Sonu.Singh.28
    @Sonu.Singh.28 3 หลายเดือนก่อน +2

    If you find the swapping using xor confusing, then instead of xor operation use the addition and subtraction operation, it will do the job.
    a = 17
    b = 27
    a = a + b # a becomes 17 + 27 = 44
    b = a - b # b becomes (17 + 27) - 27 = 44 - 27 = 17
    a = a - b # a becomes (17 + 27) - 17 = 27

  • @kingraj4797
    @kingraj4797 9 หลายเดือนก่อน +1

    I think right and left shift operation or not required for finding the i th bit is set(1) or reset(0) for given binary digits Here I have code please verify it it is taking O(1) time complexity to find it..
    // ith bit is set or reset
    import java.util.*;
    class SetOrReset{
    public static void main(String args[])
    {
    Scanner sc=new Scanner(System.in);
    String str=sc.next();
    int i=1;
    int j=str.length()-1;
    int x=str.charAt(j-i)-'0';
    if(x==1){
    System.out.println("Set");
    }else{
    System.out.println("Reset");
    }
    }
    }

  • @rahulpatil2472
    @rahulpatil2472 หลายเดือนก่อน

    for each problem if you write code that will better, but you already created playlist

  • @Mohd-12335
    @Mohd-12335 15 วันที่ผ่านมา

    we can swap without using xor ?
    a = a + b;
    b = a - b;
    a = a - b;

  • @banothutharun2743
    @banothutharun2743 9 หลายเดือนก่อน

    simple superb sir

  • @akshatchoudhary2783
    @akshatchoudhary2783 8 หลายเดือนก่อน

    Bhaiya in the Clear bit Soluton can we use XOR operation? like below
    n = 13, i =2
    13 -> 1101
    1

    • @CodeByRobin
      @CodeByRobin 4 หลายเดือนก่อน +3

      use an example where the ith bit is already 0. You will get to know

  • @mahaboobpeershaik658
    @mahaboobpeershaik658 5 หลายเดือนก่อน

    Can we get slides notes, @takeUforward
    bro?

  • @ansariaburehan263
    @ansariaburehan263 หลายเดือนก่อน

    Love it.

  • @Neo-mx2yf
    @Neo-mx2yf 7 หลายเดือนก่อน

    So in prev video, a method was taught to find ~x but it is a bit unclear. Let me try clear it up.
    Actually, ~x is just 1's complement of x, i.e., flip all bits. Eg: ~19 = ~(010011) = (101100) in binary = -20 in decimal
    Now we know (-x) is actually 2's complement of x. So what he taught is actually to find -x manually. Take prev eg, ~(010011) = (101100) in binary = -(2's complement of 101100) in decimal = -(010100) in decimal = -20
    Take other way, ~(-20) = ~(101100)=010011 in binary=(directly) 19
    Note: For easiness just assume that instead of 32 bits, there are only 6 bits here.

  • @DeadPoolx1712
    @DeadPoolx1712 4 หลายเดือนก่อน

    UNDERSTOOD;

  • @yash30095
    @yash30095 21 วันที่ผ่านมา

    understood!

  • @shashankgsharma0901
    @shashankgsharma0901 6 หลายเดือนก่อน

    Understood!

  • @ok-jg9jb
    @ok-jg9jb 10 หลายเดือนก่อน

    Thanks❤

  • @gayathripamarthi8451
    @gayathripamarthi8451 4 หลายเดือนก่อน

    That end music !!!

  • @Learnprogramming-q7f
    @Learnprogramming-q7f 10 หลายเดือนก่อน

    Thank you Bhaiya

  • @LemesaElias
    @LemesaElias 5 หลายเดือนก่อน

    In python you can swap without using a 3rd variable like a , b = b , a

    • @Phantomex984
      @Phantomex984 4 หลายเดือนก่อน +2

      u can do swap without using 3rd var in all languages just use a = 3, b = 7, b+=a, a = b-a, b = b-a, Output : , a = 7, b = 3,

  • @chirag71269
    @chirag71269 2 หลายเดือนก่อน

    STRIVER 🤩

  • @aayushgakhar3525
    @aayushgakhar3525 6 หลายเดือนก่อน

    in clearing the ith bit ques shouldnt we take -1 as while finding not of 1 its sign bit also changes in first step and so it becomes -ve and so we have to find its 2s compli

    • @CodeByRobin
      @CodeByRobin 4 หลายเดือนก่อน

      same doubt bro,, if you got the answer. Pease reply

  • @ifirdaus0_0
    @ifirdaus0_0 10 หลายเดือนก่อน

    can i use (n ^ (1

    • @aayushgupta7839
      @aayushgupta7839 10 หลายเดือนก่อน

      yes you can , I have also done the same for the code ninja question and it cleared all the test cases.

    • @coder_07
      @coder_07 10 หลายเดือนก่อน +2

      Yes , but it will work same as toggling if the bit is not set and we don't want that , if the bit will be 0 then also it will be changed to 1 if we do this.

  • @amanasrani6405
    @amanasrani6405 6 หลายเดือนก่อน

    Amazinngggggggggg❤

  • @k.k.harjeeth5422
    @k.k.harjeeth5422 7 หลายเดือนก่อน

    unset the right most set bit : n&(n-1)
    set the right most unset bit : n | (n+1)

  • @akshaydeogaonkar7120
    @akshaydeogaonkar7120 6 หลายเดือนก่อน

    How does JavaScript store numbers then? 😃

  • @kalkeshvyas7897
    @kalkeshvyas7897 3 หลายเดือนก่อน

    great

  • @riddhithbanerjee
    @riddhithbanerjee 4 หลายเดือนก่อน

    In the power of 2 case...what if the number is 0 or INT_MIN then for 0 it will be n&n-1 = 0&-1 means 0...0000 & 1...1111 its coming 0 then it will return true but actually its not power of 2
    And in case of INT_MIN n&n-1 the n-1 value is getting overflowed...please solve the doubt anyone.

  • @KartikeyTT
    @KartikeyTT 7 หลายเดือนก่อน

    tysm sir

  • @saqibaqeel9196
    @saqibaqeel9196 10 หลายเดือนก่อน

    Is this question available in leet code