add: 221025

This commit is contained in:
Eatswap 2022-10-25 14:16:06 +08:00
parent a6dc9ecaec
commit 9b74100684
Signed by: Eatswap
GPG Key ID: BE661106A1F3FA0B
2 changed files with 19 additions and 1 deletions

18
cpp/2210/221025.cpp Normal file
View File

@ -0,0 +1,18 @@
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
/**
* 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<std::string>& s, const std::vector<std::string>& t) {
return std::accumulate(s.begin(), s.end(), std::string()) == std::accumulate(t.begin(), t.end(), std::string());
}
};

View File

@ -3,4 +3,4 @@ PROJECT(2210)
SET(CMAKE_CXX_STANDARD 23) SET(CMAKE_CXX_STANDARD 23)
ADD_EXECUTABLE(2210 221024.cpp) ADD_EXECUTABLE(2210 221025.cpp)