Shifted method has been changed

This commit is contained in:
Hitaishi Goel 2024-07-20 15:58:40 +05:30
parent ca3d16dcce
commit 813b7a85df

View File

@ -10,8 +10,8 @@ export default function countSetBits(originalNumber) {
// Add last bit of the number to the sum of set bits. // Add last bit of the number to the sum of set bits.
setBitsCount += number & 1; setBitsCount += number & 1;
// Shift number right by one bit to investigate other bits. // Arithmetic Shift number right by one bit to investigate other bits.
number >>>= 1; number >>= 1;
} }
return setBitsCount; return setBitsCount;