2427. First Letter to Appear Twice
My accepted Python solution to LeetCode problem 2427, First Letter to Appear Twice, running in 0ms.
- Difficulty: Easy
- Python
- Runtime 0ms
- Memory 17MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 0ms, memory 17MB, accepted 2026-01-01.
class Solution:
def repeatedCharacter(self, s: str) -> str:
seen = set()
for c in s:
if c in seen:
return c
seen.add(c)
return ""