Fast Fourier Transform, Algorithms, Pattern Matching, Convolution, Combination Sum.
then we have: Thus we multiply S(x) and T(x) using FFT and find the coefficient vector C using the inverse FFT and for all indices c_(j+m-1) if it is equal to m, then the substring S[j:j+m] is equal to T and j is a staring index for a match. Find all such j. Here is the python code: def