diff --git a/cpp/2210/221025.cpp b/cpp/2210/221025.cpp new file mode 100644 index 0000000..d46129e --- /dev/null +++ b/cpp/2210/221025.cpp @@ -0,0 +1,18 @@ +#include +#include +#include +#include + +/** + * 1662. Check If Two String Arrays are Equivalent + * + * Given two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise. + * A string is represented by an array if the array elements concatenated in order forms the string. + */ + +class Solution { +public: + static bool arrayStringsAreEqual(const std::vector& s, const std::vector& t) { + return std::accumulate(s.begin(), s.end(), std::string()) == std::accumulate(t.begin(), t.end(), std::string()); + } +}; \ No newline at end of file diff --git a/cpp/2210/CMakeLists.txt b/cpp/2210/CMakeLists.txt index d6a3da1..44feeca 100644 --- a/cpp/2210/CMakeLists.txt +++ b/cpp/2210/CMakeLists.txt @@ -3,4 +3,4 @@ PROJECT(2210) SET(CMAKE_CXX_STANDARD 23) -ADD_EXECUTABLE(2210 221024.cpp) +ADD_EXECUTABLE(2210 221025.cpp)