summaryrefslogtreecommitdiff
path: root/check-if-two-string-arrays-are-equivalent/src/main.rs
blob: 6143793d9f3a69fd2663e2e01c175c471d5c98b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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()))
    }
}