В теме "Optimize & Solve Technique #2: DIY (Do It Yourself)" книги Cracking the coding interview Mcdowell есть интересная задачка:
Given a smaller string S and a bigger string B, design an algorithm to find all permutations of the shorter string within the longer one, print the location of each permutation (даны строки S и B, длина S не больше B, вывести положения всех перестановок строки S в строке B). Пример: S = abbc, B = cbabadcbbabbcbabaabccbabc.