Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 68db379

Browse files
solved leetcode daily challenge, Unique Email Addresses
See: Why: How: Tags:
1 parent f986b8c commit 68db379

File tree

1 file changed

+71
-0
lines changed
  • LeetCode/Unique_Email_Addresses

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#include <bits/stdc++.h>
2+
#include <gtest/gtest.h>
3+
using namespace std;
4+
5+
6+
//// START
7+
/*
8+
## Unique Email Addresses
9+
10+
*/
11+
class Solution {
12+
public:
13+
int numUniqueEmails(vector<string>& emails) {
14+
unordered_set<string> ss;
15+
for (string email: emails){
16+
string str;
17+
bool inDomain=false;
18+
bool plus = false;
19+
for (char c : email){
20+
if (inDomain){
21+
str.push_back(c);
22+
}else if (c == '@'){
23+
inDomain = true;
24+
str.push_back(c);
25+
}else if (c == '+'){
26+
plus = true;
27+
}else if (plus || c == '.'){
28+
continue;
29+
}else {
30+
str.push_back(c);
31+
}
32+
}
33+
ss.insert(str);
34+
}
35+
return ss.size();
36+
}
37+
38+
};
39+
40+
41+
42+
//// END
43+
struct T{
44+
45+
};
46+
47+
TEST(Solution,test){
48+
T ts[] = {
49+
{
50+
51+
},
52+
{
53+
54+
},
55+
56+
};
57+
58+
59+
for (T t : ts){
60+
Solution solution;
61+
62+
}
63+
}
64+
65+
int main() {
66+
testing::InitGoogleTest();
67+
68+
return RUN_ALL_TESTS();
69+
}
70+
71+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /