Easy and Simple Solution
CodePlease Like ❤️IntuitionThe problem asks to count how many strings in the list words start with the given prefix pref. The approach is straightforward: itera
# Code  
```java
class Solution {
    public int prefixCount(String[] words, String pref) {
        int res = 0;
        for (String ch : words) {
            if (ch.startsWith(pref)) {
                res++;
            }
        }
        return res;
    }
}
```

# Please Like ❤️  
![Please Like](https://media.tenor.com/heEyHbV8iaUAAAAM/puss-in-boots-shrek.gif)  
# Intuition  
The problem asks to count how many strings in the list `words` start with the given prefix `pref`. The approach is straightforward: iterate through each word and check if it starts with the prefix.

# Approach  
1. Iterate through each word in the `words` array.  
2. Use the `startsWith()` method to check if each word starts with the given prefix `pref`.  
3. Count the number of words that satisfy the condition.

# Complexity  
- **Time complexity**:  
  $$O(n \cdot m)$$, where $$n$$ is the number of words and $$m$$ is the average length of the words:  
  - The `startsWith()` method takes linear time in the length of the word, and we check this for all words.

- **Space complexity**:  
  $$O(1)$$, since we only use a few variables for counting.
['Java']