Search
⌘K

Leetcode 191. Number of 1 Bits

Count the Hamming weight (number of 1 bits) in the binary representation of a 32-bit integer. For many repeated calls, you can optimize by caching or using a precomputed bit-count lookup table.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid October, 2024

Google

Google

Junior

Find all 1 bits in a sparse bit array using a provided API query(L,R) that returns 1 if there is at least one bit equal to one in A[L..R] and 0 otherwise

Comments

Your account is free and you can post anonymously if you choose.