Simplest answer in 1 loop
Complexity
Time complexity: O(n.m)
(n for strings in array and m for length of each string)

Space complexity: O(1)
Code

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

# Complexity
- Time complexity: ***O(n.m)***
*(n for strings in array and m for length of each string)*
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```java []
class Solution {
    public int countPrefixes(String[] words, String s) {
        int count = 0;

        for(int i=0; i<words.length; i++){
            if(s.startsWith(words[i])){
                count++;
            } 
        }
        return count;
    }
}
```
['Array', 'String', 'Java']