From 4b0a6a01b051a4ebfbc17661d14cb23fe4f275fb Mon Sep 17 00:00:00 2001 From: Orangerot Date: Thu, 27 Jun 2024 11:30:16 +0200 Subject: Initial commit --- check-if-two-string-arrays-are-equivalent/src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 check-if-two-string-arrays-are-equivalent/src/main.rs (limited to 'check-if-two-string-arrays-are-equivalent/src/main.rs') 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, word2: Vec) -> 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())) + } +} -- cgit v1.2.3