Saturday, June 13, 2015

A string of length N can be made from K different symbols. Given M substrings each of max length N made using the same set of K symbols. Find the number of distinct strings which contains atleast one of the M substrings. (N, M <= 4000;  K<=2000)