Skip to content

Commit 71431c5

Browse files
author
Akash Rajpurohit
committed
🔡 Day 22
1 parent 88d0259 commit 71431c5

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
4. [Merge Intervals](https://leetcode.com/explore/challenge/card/november-leetcoding-challenge/566/week-3-november-15th-november-21st/3535/) ➡️ [CPP Solution](Week3/merge.cpp)
3030
5. [Decode String](https://leetcode.com/explore/challenge/card/november-leetcoding-challenge/566/week-3-november-15th-november-21st/3536/) ➡️ [CPP Solution](Week3/decodeString.cpp)
3131
6. [Search in Rotated Sorted Array II](https://leetcode.com/explore/challenge/card/november-leetcoding-challenge/566/week-3-november-15th-november-21st/3537/) ➡️ [CPP Solution](Week3/search.cpp)
32-
7. [Numbers At Most N Given Digit Set](https://leetcode.com/explore/challenge/card/november-leetcoding-challenge/566/week-3-november-15th-november-21st/3537/) ➡️ [CPP Solution](Week3/atMostNGivenDigitSet.cpp)
32+
7. [Numbers At Most N Given Digit Set](https://leetcode.com/explore/challenge/card/november-leetcoding-challenge/566/week-3-november-15th-november-21st/3538/) ➡️ [CPP Solution](Week3/atMostNGivenDigitSet.cpp)
3333

3434
## Week 4 🚧
35-
Coming soon...
35+
1. [Unique Morse Code Words](https://leetcode.com/explore/challenge/card/november-leetcoding-challenge/567/week-4-november-22nd-november-28th/3540/) ➡️ [CPP Solution](Week4/uniqueMorseRepresentations.cpp)
3636

3737
## Week 5 🚧
3838
Coming soon...

Week4/uniqueMorseRepresentations.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
public:
3+
int uniqueMorseRepresentations(vector<string>& words) {
4+
vector<string> code = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
5+
6+
unordered_set<string> s;
7+
8+
for(string word: words) {
9+
string str = "";
10+
for(char c: word) {
11+
int idx = c - 'a';
12+
str.append(code[idx]);
13+
}
14+
s.insert(str);
15+
}
16+
17+
return s.size();
18+
}
19+
};

0 commit comments

Comments
 (0)