COUNT NUMBER OF PREFIXES IN A LIST
IntuitionThe problem involves counting the number of words in a list that start with a given prefix. A straightforward way to solve this is by iterating through
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem involves counting the number of words in a list that start with a given prefix. A straightforward way to solve this is by iterating through the list and checking each word's prefix using slicing. This allows us to efficiently determine whether the prefix matches.

# Approach
<!-- Describe your approach to solving the problem. -->
1. Calculate the length of the prefix using len(pref).
2. Initialize a counter 'count' to zero.
3. Iterate over each word in the list:
     - Slice the first 'size' characters from the word.
        - for atlast and size=2 slicing is done 0 to 1 index so [:size]
     - Compare the slice with 'pref'. If they match, increment  'count'.
4. Return the final count.

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
 O(n * m) where n is the number of words, and m is the length of the prefix.
 Outer Loop (for word in words):
 The loop iterates through the list of words, so it runs 'n' times,
 where 'n' is the number of words in the list.

 Prefix Comparison (word[:size] == pref):
 - The slicing operation word[:size] takes O(m), where 'm' is the length of the prefix (size).
 - The equality check '== pref' also compares up to 'm' characters.
 - Therefore, this operation has a time complexity of O(m).

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(1) since no additional data structures are used

# Code
```python3 []
class Solution:
    def prefixCount(self, words: List[str], pref: str) -> int:
        size=len(pref)
        count=0
        for word in words:
            if word[:size]==pref:
                count=count+1
        return count
```
['Array', 'String', 'String Matching', 'Python3']