100% Beats | Easiest Solution | 2 Approaches | C++
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```cpp []
class Solution {
public:
    int prefixCount(vector<string>& words, string pref) {
        int count=0;
        for(auto word: words){
            for(int i=0; i<pref.size(); i++){
                if(pref[i] != word[i]) break;
                if(i==pref.size()-1) count++;
            }
        }
        return count;

        // METHOD-2: Using substring
        // int count=0;
        // for(auto word: words)
        //    if(word.substr(0, pref.length()) == pref) count++;
        // return count;

    }
};
```
['C++']