diff options
author | Orangerot <purple@orangerot.dev> | 2024-06-27 11:30:16 +0200 |
---|---|---|
committer | Orangerot <purple@orangerot.dev> | 2024-06-27 11:30:16 +0200 |
commit | 4b0a6a01b051a4ebfbc17661d14cb23fe4f275fb (patch) | |
tree | 0072cca328fe5adb2ed61004010228ff85e2164d /check-if-two-string-arrays-are-equivalent/src/main.rs |
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.rs | 13 |
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())) + } +} |