Given an array of words and a target word, return how many times the target word appears in the array.
If the target word does not appear at all, return 0.
words = ["apple", "banana", "apple", "cherry", "apple"], target = "apple"3words = ["dog", "cat", "bird"], target = "fish"0words = ["hello", "hello", "hello"], target = "hello"30 <= words.length <= 10^41 <= words[i].length <= 1001 <= target.length <= 100All strings consist of lowercase English letters.Run your code to see results
Use Cmd+Enter to run