Pergunta de entrevista da empresa Yahoo

write a program that finds all repeated substrings in the string and provide the complexity of this program. how can you make it to perform better in time and memory?