Naive best Approach
ApproachTraversing through whole array words and checking if pref == curr_pref if yes the incrementing the counter else continue.
Also : if length of word is sm


# Approach 
Traversing through whole array words and checking if pref == curr_pref if yes the incrementing the counter else continue.
Also : if length of word is smaller than pref then continue
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: O( n * length of prefix ) ~ O(n^2)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int prefixCount(vector<string>& words, string pref) {
        int cnt = 0;
        for (auto x : words) {
            if (x.length() < pref.length())
                continue;
            string curr_pref = "";
            for (int j = 0; j < pref.length(); j++) {
                curr_pref += x[j];
            }
            if (curr_pref == pref)
                cnt++;
            // else
            // continue
        }
        return cnt;
    }
};
```
['C++']