1662. Check If Two String Arrays are Equivalent Easy

@problem@discussion
#Array#String



1/**
2 * [1662] Check If Two String Arrays are Equivalent
3 *
4 * Given two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise.
5 * A string is represented by an array if the array elements concatenated in order forms the string.
6 *  
7 * Example 1:
8 * 
9 * Input: word1 = ["ab", "c"], word2 = ["a", "bc"]
10 * Output: true
11 * Explanation:
12 * word1 represents string "ab" + "c" -> "abc"
13 * word2 represents string "a" + "bc" -> "abc"
14 * The strings are the same, so return true.
15 * Example 2:
16 * 
17 * Input: word1 = ["a", "cb"], word2 = ["ab", "c"]
18 * Output: false
19 * 
20 * Example 3:
21 * 
22 * Input: word1  = ["abc", "d", "defg"], word2 = ["abcddefg"]
23 * Output: true
24 * 
25 *  
26 * Constraints:
27 * 
28 * 	1 <= word1.length, word2.length <= 10^3
29 * 	1 <= word1[i].length, word2[i].length <= 10^3
30 * 	1 <= sum(word1[i].length), sum(word2[i].length) <= 10^3
31 * 	word1[i] and word2[i] consist of lowercase letters.
32 * 
33 */
34pub struct Solution {}
35
36// problem: https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent/
37// discuss: https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent/discuss/?currentPage=1&orderBy=most_votes&query=
38
39// submission codes start here
40
41impl Solution {
42    pub fn array_strings_are_equal(word1: Vec<String>, word2: Vec<String>) -> bool {
43        false
44    }
45}
46
47// submission codes end
48
49#[cfg(test)]
50mod tests {
51    use super::*;
52
53    #[test]
54    fn test_1662() {
55    }
56}
57


Back
© 2025 bowen.ge All Rights Reserved.