Skip to content

Commit a50de5f

Browse files
committed
#2351: description update
1 parent 3749a41 commit a50de5f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

c-sharp/Problems/arrays-and-hashing/FirstLetterToAppearTwice.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@
1515
* • The letter 'b' appears on the indexes 1 and 4.
1616
* • The letter 'c' appears on the indexes 2, 3 and 7.
1717
* • The letter 'z' appears on the index 8.
18-
* • The letter 'c' is the first letter to appear twice, because out of all the letters the index of its second occurrence is the smallest.
19-
*
18+
* • The letter 'c' is the first letter to appear twice,
19+
* because out of all the letters the index of its second occurrence is the smallest.
20+
*
2021
* Example 2:
2122
* Input: s = "abcdd"
2223
* Output: "d"
2324
* Explanation: The only letter that appears twice is 'd' so we return 'd'.
24-
*
25-
*
25+
*
2626
* Constraints:
2727
* • 2 <= s.length <= 100
2828
* • s consists of lowercase English letters.
2929
* • s has at least one repeated letter.
30-
*
30+
*
3131
* Hint 1: Iterate through the string from left to right.
3232
* Keep track of the elements you have already seen in a set.
33-
*
33+
*
3434
* Hint 2: If the current element is already in the set, return that element.
3535
**
3636
* https://leetcode.com/problems/first-letter-to-appear-twice/
@@ -44,7 +44,7 @@ public class FirstLetterToAppearTwice
4444
{
4545
public char RepeatedCharacter( string s )
4646
{
47-
HashSet<char> charMap = new();
47+
HashSet<char> charMap = [];
4848

4949
foreach ( char c in s )
5050
{

0 commit comments

Comments
 (0)