link which digits must be equal
List < int > [ ] connectchars = new List < int > [ k ] ; for ( int i = 0 ; i < k ; i ++ ) connectchars [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = i % k ;