Easy solution with explanation beats 100%
IntuitionThe goal is to count how many words in the array words are prefixes of the string s. The Java String class provides the startsWith() method, which make
# Intuition
The goal is to count how many words in the array `words` are prefixes of the string `s`. The Java String class provides the `startsWith()` method, which makes it straightforward to check if one string is a prefix of another.

# Approach
1. Iterate Through the Words: Loop through each word in the words array.
2. Check Prefix: Use the startsWith() method to verify if the current word is a prefix of the string s.
3. Increment Counter: If the word is a prefix of s, increment the counter.
4. Return the Count: After checking all words, return the counter as the result.

# Complexity
## Time complexity:
- Each call to startsWith() checks up to the length of the word.
Let kk be the average length of words and mm be the number of words:

    - Total time complexity: $$O(m⋅k)$$
## Space complexity:
- $$O(1)$$

# Code
```java []
class Solution {
    public int countPrefixes(String[] words, String s) {
        int count = 0;
        for (String word : words) {
            if(s.startsWith(word))
                count++;
        }
        return count;
    }
}
```
['Java']