Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
sumitsojha88 authored May 22, 2022
2 parents 5a51116 + e4724d0 commit a7b2e5d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 17 additions & 3 deletions DSA Preparation 450/Bit Manipulation/Bit Difference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,25 @@ int countBitsFlip(int a, int b){
int c=a^b;
while(c)
{
c = c&(c-1);


c = c&(c-1);
count++;
}
// 11110 = c
// 11101 = c-1
// c = c&(c-1);
// step -> 1
// c = 11100
// c-1 = 11011
// step -> 2
// c = 11000
// c-1 = 10111
// step -> 3
// c = 10000
// c-1 = 01111
// step -> 4
// c = 00000
// that means -> a^b == 0 -> a and b are equal.


return count;

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@ It will be a complete roadmap for your placement prep.
1️⃣ [Tutorialpoint](https://www.tutorialspoint.com/java/index.htm)
2️⃣ [GFG](https://www.geeksforgeeks.org/java/)
3️⃣ [Scaler Topics](https://www.scaler.com/topics/java/)
2️⃣ [GFG](https://www.geeksforgeeks.org/java/)
3️⃣ [Scaler Topics](https://www.scaler.com/topics/java/)
* Time Required: same as above
* Python
* Refrences:
1️⃣ [Tutorialspoint](https://www.tutorialspoint.com/python/index.htm)
2️⃣ [w3schools](https://www.w3schools.com/python/)
3️⃣ [Scaler Topics](https://www.scaler.com/topics/python/)
2️⃣ [w3schools](https://www.w3schools.com/python/)
3️⃣ [Scaler Topics](https://www.scaler.com/topics/python/)
* Time Required: same as above
* **Important Callout:** Some companies don't allow python as a coice in their online coding test, so prepare accordingly
</details>
Expand Down

0 comments on commit a7b2e5d

Please sign in to comment.