DrawCode

Brian Kernighan's Algorithm

Clear the lowest set bit with n &= n-1 to count set bits in O(popcount) iterations.

Browse free without an account. Sign in to save progress, sync likes, and open your canvas workspace.