Abstract
We investigate constant-composition constrained codes for the mitigation of intercell interference for multilevel cell flash memories with a dynamic threshold scheme. The first explicit formula for the maximum size of a q -ary {\mathcal F} -avoiding code with a given composition and certain families of substrings {\mathcal F} is presented. In addition, we provide methods to determine the asymptotic rate for {\mathcal F} -avoiding codes with any composition ratio and to find the optimal composition ratio that maximizes the asymptotic rate. We also give the first efficient encoder/decoder for these q -ary constant-composition codes achieving the channel capacity, for all q values.