Counting Words | Simple Answer | Wildfire Solution
IntuitionThe problem requires counting how many words in a list start with a specific prefix. The simplest approach is to iterate through the list of words and
# Intuition
The problem requires counting how many words in a list start with a specific prefix. The simplest approach is to iterate through the list of words and check if each word begins with the prefix. This can be efficiently done using the startswith() method provided by Python.
# Approach
Initialize a counter variable (count) to zero.
Loop through the list of words:
For each word, use the startswith() method to check if it begins with the given prefix.
If the condition is true, increment the counter by one.
Once all words have been checked, return the value of the counter as the result.


# Complexity
- Time complexity:
O(n⋅m)
n: Number of words in the list.
m: Average length of the words or the prefix length 
   (whichever is smaller).
The startswith() method performs a character-by-character       comparison for up to the prefix length

- Space complexity:
O(1)
The approach uses constant space since no additional data structures are created, apart from a few variables for counting and iteration.

# Code
```python []
class Solution(object):
    def prefixCount(self, words, pref):
        """
        :type words: List[str]
        :type pref: str
        :rtype: int
        """
        count = 0
        for i in words:
            if i.startswith(pref):
                count += 1

        return count
```
['Python']