Java🍵|Brute Force✅|Easy🔥
Complexity

Time complexity: O(n * m)


Space complexity: O(1)

Code
# Complexity
- Time complexity: **O(n * m)**

- Space complexity: **O(1)**

# Code
```java []
class Solution {
    public int prefixCount(String[] words, String pref) {
        int n = words.length;
        int m = pref.length();
        int count = 0;
        for (String word: words) {
            if (m > word.length())
                continue;
            else {
                boolean flag = true;
                for (int k = 0; k < m; k++) {
                    if (pref.charAt(k) != word.charAt(k)) {
                        flag = false;
                        break;
                    }
                }
                if (flag) {
                    count++;
                }
            }
        }
        return count;
    }
}
```
['Array', 'String', 'Java']