Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions solutions/python/practice10.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
# - Input: "abccbaacz" → Output: "c" (first appears at index 2, then again at index 3)
# - Input: "abcdd" → Output: "d" (first appears at index 3, then again at index 4)
#
# Explanation (plain English):
# We read the string one letter at a time and keep a "seen" box of letters.
# For each letter, we check the box. If the letter is already there, it is
# the first one to repeat, so we return it. If not, we put it in the box.
# If we reach the end with no repeat, we return None.
#
# Status: ✅ SOLVED

def first_letter_twice(s):
Expand Down
Loading