Unthinkable interview question

Longest common substring problem : worst case and best case time complexity