← All problemsSign in

Chef and Binary number

Chef loves playing with integers 0 and 1 a lot. He always wants to convert an integer into its binary representation and does some experiment on that. Suppose Chef has a number N and he writes binary representation of all numbers from 0 to 2N-1. He then converts all the 0 in the binary representation to 1 and 1 to 0. Your job's is to help chef to count the total numbers having consecutive 1's in t

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