2351. First Letter to Appear Twice
On This Page
class Solution:
def repeatedCharacter(self, s: str) -> str:
mask = 0
for c in s:
i = ord(c) - ord('a')
if mask >> i & 1:
return c
mask |= 1 << i