Skip to content

Commit ddd3be1

Browse files
committed
Runtime: 3 ms (Top 85.58%) | Memory: 8.5 MB (Top 62.02%)
1 parent df90571 commit ddd3be1

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
1+
// Runtime: 3 ms (Top 85.58%) | Memory: 8.5 MB (Top 62.02%)
12
class Solution {
23
public:
3-
4+
45
string convert(string st)
56
{
67
string s1[]={".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
78
string s="";
89
for(char a:st)
910
{
1011
s+=s1[a - 'a'];
11-
12+
1213
}
1314
return s;
14-
15+
1516
}
1617
int uniqueMorseRepresentations(vector<string>& words) {
17-
18-
set<string>st;
18+
19+
set<string>st;
1920
for(int i=0;i<words.size();i++)
2021
{
2122
st.insert(convert(words[i]));
22-
23-
24-
23+
2524
}
26-
27-
25+
2826
return st.size();
2927
}
30-
};
28+
};

0 commit comments

Comments
 (0)