Skip to content
Code ReadingRepeated Letter
Read the Big-O

Repeated Letter

A text of n characters. For each letter, the rest of the text is searched: how does the time grow?
1def has_repeat(text):
2 for i in range(len(text)):
3 if text[i] in text[i + 1:]:
4 return True
5 return False