2351. First Letter to Appear Twice
Given a string s consisting of lowercase English letters, return the first letter to appear twice. Note: - A letter a appears twice before another letter b if the second occurrence of a is before the second occurrence of b. - s will contain at least one letter that appears twice. Example 1: Input: s = "abccbaacz" Output: "c" Explanation: The letter 'a' appears on the indexes 0, 5 and 6. The
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start