You can xor and calculate the set bits using brian kernighan algorithm. I have posted a video using this approach. Its more optimised than calculating the set bits using this method.
Big fan of your consistency every day your new video got recommended but unfortunately i have leraned cpp is there is any good playlist of cpp in yt of hackrank or leetcode
Create a playlist to teach dsa to a person who don't know anything from scrqtch...it would be awesome to know how much he learned
thanx.for solving the problem its really helpful
Happy to help
Great dude Keep going soon you will reach 10K , 100k , 200k … so on. Just be consistent. Your voice is also catchy.
Thanks for the push. Means a lot !✨
I respect you❤❤❤
or we can also perform the XOR operation and then count the set bits directly,
```
int minBitFlips(int start, int goal) {
bitset binary(start^goal);
return binary.count(); // counts and returns set bits
}
```
You can xor and calculate the set bits using brian kernighan algorithm. I have posted a video using this approach. Its more optimised than calculating the set bits using this method.
@@LeetCodeIO-Anuj Just checked your video. It's indeed an interesting approach that I wasn't aware of.
Thank you for your response.
@@anuragdubey8169 Brian Kernighan is indeed one of the most common algorithm while solving bits related problems.
Great work !
done mam 😊😊
Well done !
Big fan of your consistency every day your new video got recommended but unfortunately i have leraned cpp is there is any good playlist of cpp in yt of hackrank or leetcode
Thank youu, I am not aware of any channel which posts daily challenge video in cpp
how did you approach this question using your intuition
I’d love to hear more about your thought process
Just counting the number of bits which are different will do the work