2351. First Letter to Appear Twice
Easy
Given a string s
consisting of lowercase English letters, return the first letter to appear twice.
Note:
A letter
a
appears twice before another letterb
if the second occurrence ofa
is before the second occurrence ofb
.s
will contain at least one letter that appears twice.
Example 1:
Example 2:
Constraints:
2 <= s.length <= 100
s
consists of lowercase English letters.s
has at least one repeated letter.
解題
Last updated