medium10 pts · first answer countsmathbit-manipulation
Loop count of n &= n - 1
How many times does the loop body run for n = 0b101100?
let count = 0
while (n !== 0) {
n &= n - 1
count++
}Discussion 0
Join free to post in the discussion.
Related questions
- Remainder of a negative numberBackend Developer
- Why 0.1 + 0.2 is not 0.3Backend Developer
- Storing rupee amounts safelyBackend Developer
- GST inside an inclusive priceBackend Developer
- How many buses are neededBackend Developer
- Checking for a power of twoBackend Developer
- Which year is a leap yearBackend Developer
- Month number in new DateBackend Developer