← All problemsSign in

Equal Hamming Distance

CodeChefRating 1873Open on judge ↗

Chef is given two binary strings $A$ and $B$, each having length $N$. Chef wants to find the number of binary strings $C$, of length $N$, such that $H(A, C) = H(B, C)$, where $H(X, Y)$ denotes the *hamming distance* between the strings $X$ and $Y$. Since the answer can be large, output it modulo $10^9+7$. Note: [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between two strin

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