JAVA | Faster Than 100% | Runtime : 1ms
Complexity
Time complexity: O(N)

Space complexity: O(N)
Code

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

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

# Code
```java []
class Solution {
    public int prefixCount(String[] words, String pref) {
        int n=pref.length(),c=0;
        for(String i:words){
            if(i.length()>=n && i.substring(0,n).equals(pref)){
                c+=1;
            }
        }
        return c;
    }
}
```
['Java']