Bit manipulation playground
mediumx & (x−1) clears the lowest set bit; x & −x isolates it. Between them they give you popcount, power-of-two tests and subset enumeration, all in single instructions.
Worst
O(1) per operationSpace O(1)Loading the bit manipulation playground engine…