← All problemsSign in

Hammingtons Mayhem

Mr. Hammington really likes $1$. He gives you a number $N$ in base $2$. Let $H(N)$ denote the number of set bits(i.e. $1$s) in $N$. Let $H^n(N)$ is defined as function obtained by applying function $H(\cdot)$, $n-$times to $N$. Formally, - $H^1(N)=H(N)$ - $H^n(N)=H(H^{n-1}(N))$ for $n\geq2$. Mr. Hammington describes a special function $F(N)$, which denotes the smallest value of $n$ such that $H^

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