Skip to content

Commit 25049bc

Browse files
committed
Runtime: 4 ms (Top 25.64%) | Memory: 6.2 MB (Top 18.83%)
1 parent 7aae3ab commit 25049bc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
class Solution
1+
// Runtime: 4 ms (Top 25.64%) | Memory: 6.2 MB (Top 18.83%)
2+
class Solution
23
{
34
public:
4-
char repeatedCharacter(string s)
5+
char repeatedCharacter(string s)
56
{
67
unordered_map<char, int> mp; //for storing occurrences of char
7-
8+
89
char ans;
910
for(auto it:s)
1011
{
11-
if(mp.find(it) != mp.end()) //any char which comes twice first will be the ans;
12+
if(mp.find(it) != mp.end()) //any char which comes twice first will be the ans;
1213
{
1314
ans = it;
1415
break;
@@ -17,4 +18,4 @@ class Solution
1718
}
1819
return ans;
1920
}
20-
};
21+
};

0 commit comments

Comments
 (0)