Swap all Odd and Even Bits | Bit Manipulation for Competitive Programming

Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we discuss the problem where we are required to swap all odd and even bits in a number using bit manipulation, Also check out some cool moves by Sumeet Sir here 09:49.
In this problem,
1. You are given a number n.
2. You have to swap all odd position bits with even position bits.
3. Every odd position bit is swapped with adjacent bit on left side.
4. Every even position bit is swapped with adjacent bit on right side.
5. Print the number formed after swapping.
To submit the question, click here: www.pepcoding.com/resources/d...
For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
Have a look at our result: www.pepcoding.com/placements
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education

Пікірлер: 40

  • @rudraksh9635
    @rudraksh96353 жыл бұрын

    Sir channel is legit growing .. my senior recommended this channel today , but i m avid subscriber from way back !! ✌🏻 Family of 11.5k

  • @Pepcoding

    @Pepcoding

    3 жыл бұрын

    bass pyar bna rahe. pyar se upar kya hai!! LOL! padhte raho yar, mai to mze ke liye bna rha hun

  • @Pepcoding

    @Pepcoding

    3 жыл бұрын

    ek review ki request rahegi g.page/Pepcoding/review?rc

  • @SaumyaSharma007

    @SaumyaSharma007

    3 жыл бұрын

    @@Pepcoding SIR I GAVE THE REVIEW.......... This is the min thing that I can give you for your extraordinary efforts. HUGE RESPECT FROM PINK CITY, JAIPUR.

  • @adityasrivastava7956

    @adityasrivastava7956

    3 жыл бұрын

    @@SaumyaSharma007 lol

  • @abhishek-singh31
    @abhishek-singh313 жыл бұрын

    Awesome Content. 👍🏻 Following this bit manipulation playlist and it's amazing 🙏🏻

  • @ChandanKSwain
    @ChandanKSwain Жыл бұрын

    very thankful for this level of explaination.

  • @aryaraj1898
    @aryaraj1898 Жыл бұрын

    your happiness after solving the prblm was at next level i have also got same joy thnk you so much sir❤❤❤

  • @TuringTested01

    @TuringTested01

    Жыл бұрын

    lmao jhoot bolte reh

  • @lifeisfun4863
    @lifeisfun4863 Жыл бұрын

    These are part of which lecture series???

  • @lakshaydahiya3400
    @lakshaydahiya34003 ай бұрын

    How come 10001000>>1 is 01000100? Shouldn't it be 11000100? This solution is valid only when the input number is + or 0. Even on GFG,it is mentioned unsigned int...maybe sir forgot to make a mention of it

  • @codingdose3399
    @codingdose33992 жыл бұрын

    why are we using X instead of * am i missing something

  • @ayushsrivastava2397
    @ayushsrivastava23972 жыл бұрын

    ek dum mast ....sir

  • @Pepcoding

    @Pepcoding

    2 жыл бұрын

    Hope you like the video, for better experience, doubt support, career opportunities and well-organised content, visit - nados.pepcoding.com Don't forget to follow us on Instagram instagram.com/pepcoding/

  • @bhushanambhore8378
    @bhushanambhore83782 жыл бұрын

    9:49 unexpected 😂. Well explained !!

  • @Pepcoding

    @Pepcoding

    2 жыл бұрын

    Glad you love the explanation! For better experience and well organised content sign up on nados.io and stay updated

  • @0_0-0_0.
    @0_0-0_0.2 жыл бұрын

    9:49 so funny 😅😅 i can relate your feelings for that point 😁

  • @devanshuagrawal7557
    @devanshuagrawal75573 жыл бұрын

    Sir i am doing bcom but i am solving coding questions can i sit for off campus interviews

  • @Pepcoding

    @Pepcoding

    3 жыл бұрын

    beta pta nahi ache se, tumhare college ka kya scene hai. Open market mei takleef jaroor hogi par problem solvable hai.

  • @aman6561
    @aman65613 жыл бұрын

    sr ye bit manipulation ke questions complete krne ke almost kaafi mask bnane aa jaenge na? dikkt to ni hogi mask bnane me jese abhi ye new treeke se mask bna hai isme

  • @Pepcoding

    @Pepcoding

    3 жыл бұрын

    hanji, full 30 questions hain. Iske baad khud ko leetcode, interviewbit ki Bits pe ajma kar dekh lena

  • @aman6561

    @aman6561

    3 жыл бұрын

    @@Pepcoding subha tk complete ho jaenge 5 bche hai fr try krunga

  • @amey203
    @amey2033 жыл бұрын

    why are we right shifting and left shifting numbers?

  • @vedantagarwal22

    @vedantagarwal22

    3 жыл бұрын

    bcoz after swapping even bits will come one place right and odd bits will go one place left.

  • @dinkarkorlekar8305
    @dinkarkorlekar83052 жыл бұрын

    sir please try adding playlist of individual video below description

  • @Pepcoding

    @Pepcoding

    2 жыл бұрын

    Sure. Please checkout nados.pepcoding.com for the best experience, Everything is precisely arranged there.

  • @shankaranand9129
    @shankaranand91293 жыл бұрын

    very good explanation

  • @Pepcoding

    @Pepcoding

    3 жыл бұрын

    Thankyou ji! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.

  • @ABHISHEKKUMAR-wf3yh
    @ABHISHEKKUMAR-wf3yh3 жыл бұрын

    great one...

  • @Pepcoding

    @Pepcoding

    3 жыл бұрын

    I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like our efforts, we request a review g.page/Pepcoding/review?rc You can subscribe to our channel here kzread.infoabout?view_as=subscriber

  • @nishthagoyal5018
    @nishthagoyal50183 жыл бұрын

    great sir

  • @Pepcoding

    @Pepcoding

    3 жыл бұрын

    padhte rahie

  • @codewithscooby4142
    @codewithscooby41423 жыл бұрын

    great sir!!!

  • @Pepcoding

    @Pepcoding

    3 жыл бұрын

    bro, sahi lag rha to ek 5 star review dedo. Aur content daalunga dher sara. g.page/Pepcoding/review?rc

  • @PawanKumar-eo7mh

    @PawanKumar-eo7mh

    3 жыл бұрын

    @@Pepcoding Done Dana done 👍

  • @loserfruit9663
    @loserfruit96633 жыл бұрын

    Can someone tell why are we only giving right shift to even numbers and left to odd numbers? Can't we do opposite of this left shift to even and right to odd if no? Then why

  • @mayur_madhwani03

    @mayur_madhwani03

    2 жыл бұрын

    opposite won't work because if you see in even mask bit ends with 0 and starts with 1 and if you shift it to left then one preserved bit will go out of range but if you shift it to right then unpreserved bit will be deleted

  • @rohitenwurd9294

    @rohitenwurd9294

    6 ай бұрын

    1 is the first odd digit, it is swapped with the first even digit(2) which is on its left side that's why

  • @FunShorts217
    @FunShorts2172 жыл бұрын

    worst explanation ever, never explained the approach.