Reverse Bits | LeetCode 190 | C++, Java, Python

Sdílet
Vložit
  • čas přidán 11. 07. 2020
  • LeetCode Solutions: • LeetCode Solutions | L...
    June LeetCoding Challenge: • Playlist
    May LeetCoding Challenge: • Playlist
    Github Link: github.com/KnowledgeCenterYou...
    *** Best Books For Data Structures & Algorithms for Interviews:*********
    1. Cracking the Coding Interview: amzn.to/2WeO3eO
    2. Cracking the Coding Interview Paperback: amzn.to/3aSSe3Q
    3. Coding Interview Questions - Narasimha Karumanchi: amzn.to/3cYqjkV
    4. Data Structures and Algorithms Made Easy - N. Karumanchi: amzn.to/2U8FrDt
    5. Data Structures & Algorithms made Easy in Java - N. Karumanchi: amzn.to/2U0qZgY
    6. Introduction to Algorithms - CLR - Cormen, Leiserson, Rivest: amzn.to/2Wdp8rZ
    *****************************************************************************
    July LeetCoding Challenge | Problem 12 | Subsets | 12 July,
    Facebook Coding Interview question,
    google coding interview question,
    leetcode,
    Reverse Bits,
    Reverse Bits c++,
    Reverse Bits Java,
    Reverse Bits python,
    Reverse Bits solution,
    190. Reverse Bits,
    #CodingInterview #LeetCode #JulyLeetCodingChallenge #Google #Amazon #ReverseBits

Komentáře • 56

  • @agileprogramming7463
    @agileprogramming7463 Před 4 lety +11

    This is the real content which gives us the technical skills we need..

  • @rohitgupta7037
    @rohitgupta7037 Před 3 lety +1

    Very good explanation. I tried to understand this logic in so many videos/code but was not able to follow until I saw this video. Thanks !!!

  • @chetanshrivastava3762
    @chetanshrivastava3762 Před 4 lety +1

    Very nice explanation sir...first solution which comes to me is to use builtin function..(return int('{:032b}'.format(n)[::-1],2)) which is very easy(convert integer into 32 bits binary,reverse & convert into integer ).

  • @ambersinghrok
    @ambersinghrok Před 4 lety +8

    hats off!!!.. every single day you show up !!!

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety +3

      It may not be possible every day in future. But, will be try to do so as much as I can.

    • @harshk3351
      @harshk3351 Před 4 lety +3

      @@KnowledgeCenter Sir pls solve Graphs problems as much as possible because on youtube there is no much content available on Graphs and Obviously the way you explained is SUPERB, Thankyou so much Sir.!!!

    • @shashankjha4134
      @shashankjha4134 Před 4 lety +3

      @@KnowledgeCenter please don't say this sir. at least keep posting the solutions of daily challenges.
      after brainstorming for 1 hour even if I solve the problem I wait for your video because you always come up with an extra approach.

  • @nikhilghodke3422
    @nikhilghodke3422 Před 4 lety +2

    Genuinely grateful to u sir. U are seriously better than all online competitive coder on youtube ( most of them just showoff)

    • @raviashwin1157
      @raviashwin1157 Před 4 lety +3

      Yes bro,wo sirf fake dreams dikhate hain ....aur jab kuch padhane ki bari aati hain kuch nahi padhate

    • @nikhilghodke3422
      @nikhilghodke3422 Před 4 lety +1

      @@raviashwin1157 exactly bro

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety +6

      On youtube videos having Tips and Tricks sell more. People are looking for some shortcut, some magic trick. But, there is generally no shortcuts to learning & mastering concepts. One has learn everyday and practice every day. Yes, some guidance and mentoring is required. But, mostly it will be driven by yourself. Your Will.

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety

      Thanks for compliments.

    • @raviashwin1157
      @raviashwin1157 Před 4 lety +1

      @@KnowledgeCenter Sir keep doing this job ...we as a subscriber will share your videos and tell our friends about this channel....very few people in today's world really work honestly like you.

  • @AyushRaj-pm1dz
    @AyushRaj-pm1dz Před rokem

    In the first approach , why are we doing "res

  • @srivatsav9288
    @srivatsav9288 Před 4 lety +1

    very intuitive ! what digital pad you use ? can you share the link if possible ?

  • @GokuVidhayak
    @GokuVidhayak Před 2 lety

    i converted the bit to string using bitset and reversed it but how to convert it back to uint?????

  • @rainethai4357
    @rainethai4357 Před 3 lety +1

    approach 2 (bit masking) can't be done in java. do you know why?

  • @Anonymous-ny1yy
    @Anonymous-ny1yy Před 4 lety +1

    Great !

  • @paragroy5359
    @paragroy5359 Před 2 lety +1

    Nice explanation your videos are really good...please keep on making such videos...you are doing a great job.

  • @kalyanreddy3176
    @kalyanreddy3176 Před 3 lety +1

    Really helpful, keep the good work going on..

  • @devanshsolani2711
    @devanshsolani2711 Před 3 lety +1

    I hope all of you watching this will be great Software Engineers

  • @aapoopee1239
    @aapoopee1239 Před 3 lety +1

    Ty most helpful video on yt!

  • @monojtewari2071
    @monojtewari2071 Před rokem +1

    thank you for this amazing explanation

  • @raviashwin1157
    @raviashwin1157 Před 4 lety +3

    Great job sir 👍

  • @XXIcenturyblood
    @XXIcenturyblood Před 3 lety

    Thank you !

  • @amrholo4445
    @amrholo4445 Před rokem +1

    Thanks a lot 💞💞

  • @ankurkumar8465
    @ankurkumar8465 Před 3 lety +2

    Nice explanation sir... ❤

  • @ShubhamSharma-xt5ft
    @ShubhamSharma-xt5ft Před 4 lety +1

    very good explanation

  • @gourav.barkle
    @gourav.barkle Před 3 lety +1

    Thank you

  • @luckyim6504
    @luckyim6504 Před 2 lety +1

    bless

  • @srujangowda9975
    @srujangowda9975 Před 3 lety +1

    Take a bow hero.. take a bow!

  • @anjanobalesh8046
    @anjanobalesh8046 Před 4 měsíci +1

    The second approach complicates everything

  • @ilanaizelman3993
    @ilanaizelman3993 Před 2 lety +1

    WD!

  • @prabhatchanchal
    @prabhatchanchal Před 4 lety +2

    C++
    bitset x(n);
    auto str = x.to_string();
    std::reverse(str.begin(), str.end());
    auto y = std::bitset(str);
    return (uint32_t) y.to_ulong();
    Java
    String bin=Integer.toBinaryString(n);
    bin=new StringBuilder(bin).reverse().toString();
    return Integer.parseInt(bin,2);
    but same logic not worked in java.
    because java do not have unsigned type :(

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety +1

      Great, you tried. Thanks for sharing.

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety +1

      @Prabhat. You don't need to code in multiple languages, you can choose 1 language.