We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59a889d commit ff18ff9Copy full SHA for ff18ff9
solution/0929.Unique Email Addresses/Solution.java
@@ -0,0 +1,17 @@
1
+class Solution {
2
+ public int numUniqueEmails(String[] emails) {
3
+ Set<String> set = new HashSet<>();
4
+ for (String email : emails) {
5
+ int index = email.indexOf('@');
6
+ String local = email.substring(0, index);
7
+ String domain = email.substring(index);
8
+ index = local.indexOf('+');
9
+ if (index != -1) {
10
+ local = local.substring(0, index);
11
+ }
12
+ local = local.replace(".", "");
13
+ set.add(local + domain);
14
15
+ return set.size();
16
17
+}
0 commit comments