summaryrefslogtreecommitdiff
path: root/check-if-two-string-arrays-are-equivalent/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'check-if-two-string-arrays-are-equivalent/src/main.rs')
-rw-r--r--check-if-two-string-arrays-are-equivalent/src/main.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/check-if-two-string-arrays-are-equivalent/src/main.rs b/check-if-two-string-arrays-are-equivalent/src/main.rs
new file mode 100644
index 0000000..6143793
--- /dev/null
+++ b/check-if-two-string-arrays-are-equivalent/src/main.rs
@@ -0,0 +1,13 @@
+fn main() {
+ println!("Hello, world!");
+}
+
+struct Solution;
+
+impl Solution {
+ pub fn array_strings_are_equal(word1: Vec<String>, word2: Vec<String>) -> bool {
+ //word1.iter_mut().reduce(|a, b| {a.push_str(b); a}).unwrap() == word2.iter_mut().reduce(|a, b| {a.push_str(b); a}).unwrap()
+ //word1.concat() == word2.concat()
+ word1.iter().flat_map(|x| x.chars()).eq(word2.iter().flat_map(|x| x.chars()))
+ }
+}