← ALL NOTES
Math

762. Prime Number of Set Bits in Binary Representation

Count how many integers in [left, right] have a prime number of set bits. The scope observation makes this easy: since right <= 10^6 < 2^20, any number has at most 20 set bits, so the popcount is a…

Loading…