Strings: refactor your code such that there is no duplicate code in the file. Is there a way you could use 1 of the three functions and use them in the other two for the same result? Or use a helper function?
I see that you annotated for time complexity. Do the same for space complexity. How much space is your function using? Are you allocating any arrays, sets, dictionaries, etc?