You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Understand what the interviewer is asking for by using test cases and questions about the problem.
What if there are no repeated characters?
In this case, return None.
P-lan
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Loop through the input string while maintaining a tracker of previously seen characters.
1) Create a list to track seen characters
2) Loop through the input string while also tracking current index
a) If the character has previously been found in the string, return the current index
b) Otherwise add the character to the list of seen characters
3) If no characters end up being seen twice, return None