← All problemsSign in

762. Prime Number of Set Bits in Binary Representation

LeetCodeMathBit ManipulationOpen on judge ↗

Given two integers left and right, return the count of numbers in the inclusive range [left, right] having a prime number of set bits in their binary representation. Recall that the number of set bits an integer has is the number of 1's present when written in binary. - For example, 21 written in binary is 10101, which has 3 set bits. Example 1: Input: left = 6, right = 10 Output: 4 Explanat

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start