Skip to content

Commit 619b3a8

Browse files
committedJan 1, 2023
add 2351
1 parent be9e6a4 commit 619b3a8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ LeetCode
790790
|2225|[Find Players With Zero or One Losses](https://leetcode.com/problems/find-players-with-zero-or-one-losses/)||[c++](./src/2225-Find-Players-With-Zero-or-One-Losses/2225.cpp)||||||Medium|
791791
|2256|[Minimum Average Difference](https://leetcode.com/problems/minimum-average-difference/)||[c++](./src/2256-Minimum-Average-Difference/2256.cpp)||||||Medium|
792792
|2279|[Maximum Bags With Full Capacity of Rocks](https://leetcode.com/problems/maximum-bags-with-full-capacity-of-rocks/)||[c++](./src/2279-Maximum-Bags-With-Full-Capacity-of-Rocks/2279.cpp)||||||Medium|
793+
|2351|[First Letter to Appear Twice](https://leetcode.com/problems/first-letter-to-appear-twice/)||[c++](./src/2351-First-Letter-to-Appear-Twice/2351.cpp)||||||Easy|
793794
|2389|[Longest Subsequence With Limited Sum](https://leetcode.com/problems/longest-subsequence-with-limited-sum/)||[c++](./src/2389-Longest-Subsequence-With-Limited-Sum/2389.cpp)||||||Easy|
794795
|2469|[Convert the temperature](https://leetcode.com/problems/convert-the-temperature/)||[c++](./src/2469-Convert-the-Temperature/2469.cpp)||||||Easy|
795796
|2470|[Number of Subarrays With LCM Equal to K](https://leetcode.com/problems/number-of-subarrays-with-lcm-equal-to-k/)||[c++](./src/2470-Number-of-Subarrays-With-LCM-Equal-to-K/2470.cpp)||||||Medium|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
char repeatedCharacter(string s) {
4+
int cnt[26] = {};
5+
for (auto c : s) {
6+
auto x = c - 'a';
7+
if (cnt[x]) return c;
8+
cnt[x]++;
9+
}
10+
return ' ';
11+
}
12+
};

0 commit comments

Comments
 (0)