← All problemsSign in

Dhapu and Binary Numbers

Dhapu loves programming. So naturally she loves the language of ones and zeroes. She has created a function bitcount(x) which returns the number of set bits in the binary representation of the number 'x'. She would love to stress test her program's performance. She feeds it with queries consisting of 2 integers - l and r. The objective of her program is to find the number 'x' (between l and r, in

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