Practice Count Common Words With One Occurrence
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given two string arrays words1 and words2, return the number of strings that appear exactly once in each of the two arrays.
Source: Count Common Words With One Occurrence on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
words1 = ["leetcode","is","amazing","as","is"], words2 = ["amazing","leetcode","is"]
Output
2
# Example 2
Input
words1 = ["b","bb","bbb"], words2 = ["a","aa","aaa"]
Output
0
# Example 3
Input
words1 = ["a","ab"], words2 = ["a","a","a","ab"]
Output
1
Constraints
1 <= words1.length, words2.length <= 1000
1 <= words1[i].length, words2[j].length <= 30
words1[i] and words2[j] consists only of lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Count Common Words With One Occurrence.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.