A Lovely Number
CodeChefOpen on judge ↗
We define a number as Lovely number if it repeats certain number twice in its binary representation and there is no other bit. For example, binary representation 10 is “ 1010” . As you can see 10 is repeating exactly twice, so it is a Lovely number. Another example, binary representation of 21 is “10101”. Here 10 is repeating twice but there is an extra 1 at the end. So, 21 is not a Lovely numbe
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.
Sign in to chat with the tutor and save your progress.
Sign in to start