Help Bob
CodeChefOpen on judge ↗
As, you know Alice and Bob love to challenge each other. So, one day Alice defined a function : $f(n, k) = \sum_{i=0}^{n} min(1, i \& k) $ Where $&$ is bitwise AND operator. Now, Alice gave Bob two integers $k$ and $x$ and then challenged him to find maximum $n$ such that $: f(n, k) = x$. Turns out, Bob is not as smart as you so he wants your help to find maximum such $n$, help Bob and outpu
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