diff --git a/cpp/2204/220410-CN.cpp b/cpp/2204/220410-CN.cpp new file mode 100644 index 0000000..e5716a6 --- /dev/null +++ b/cpp/2204/220410-CN.cpp @@ -0,0 +1,23 @@ +#include +#include +#include + +class Solution { +private: + inline static const std::string MORSE[] = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."}; +public: + static int uniqueMorseRepresentations(const std::vector& words) { + std::unordered_set s; + for (const auto& str : words) { + std::string t; + for (char ch : str) + t += MORSE[ch - 'a']; + s.insert(t); + } + return s.size(); + } +}; + +int main() { + return 0; +} diff --git a/cpp/2204/CMakeLists.txt b/cpp/2204/CMakeLists.txt index 4d08d91..9de3d26 100644 --- a/cpp/2204/CMakeLists.txt +++ b/cpp/2204/CMakeLists.txt @@ -3,4 +3,4 @@ PROJECT(2204) SET(CMAKE_CXX_STANDARD 23) -ADD_EXECUTABLE(2204 220409.cpp) +ADD_EXECUTABLE(2204 220410-CN.cpp)