Skip to content

Commit be2f152

Browse files
committed
Time: 1 ms (50.81%) | Memory: 43.1 MB (87.43%) - LeetSync
1 parent 4df546c commit be2f152

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public int countPrefixes(String[] words, String s) {
3+
4+
int count=0;
5+
StringBuilder sb = new StringBuilder(s);
6+
for(String word : words){
7+
int temp = s.indexOf(word);
8+
if(temp==0){
9+
count++;
10+
}
11+
}
12+
return count;
13+
}
14+
}

0 commit comments

Comments
 (0)