Tap here to switch tabs
Problem
Submissions

Problem: First Letter to Appear Twice

Try to solve the First Letter to Appear Twice problem.

Statement

Given a string s consisting of lowercase English letters, return the first character that appears twice.

A character is considered the first to appear twice if the index of its second occurrence is strictly smaller than the index of the second occurrence of any other character.

Note: s is guaranteed to contain at least one character that appears multiple times.

Constraints:

  • 2≤2 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • s contains at least one repeated letter.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: First Letter to Appear Twice

Try to solve the First Letter to Appear Twice problem.

Statement

Given a string s consisting of lowercase English letters, return the first character that appears twice.

A character is considered the first to appear twice if the index of its second occurrence is strictly smaller than the index of the second occurrence of any other character.

Note: s is guaranteed to contain at least one character that appears multiple times.

Constraints:

  • 2≤2 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • s contains at least one repeated letter.