Cheap Transmission
CodeChefOpen on judge ↗
Let $A$ and $B$ be bit strings (sequences of $0$'s and $1$'s). If $A$ is equal to the leftmost $length(A)$ bits of $B$, then $A$ is said to be a prefix of $B$. For example, $00110$ is a prefix of $001101001$, but not of $00111$ or $100110$. A prefix-free code of size $n$ is a collection of $n$ distinct bit strings such that no string is a prefix of any other. For example, this is a prefix-f
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