
It can be easily proven using Hall's marriage theorem that given fixed \$n\$ and \$k<n/2\$, there is an injective (one-to-one) function from all \$n\$-bit strings with \$k\$ ones to \$n\$-bit strings with \$k+1\$ ones such that an input and its corresponding output differ by exactly one bit. For ...