Skip to content

Commit f1caa49

Browse files
committed
Runtime: 15 ms (Top 52.29%) | Memory: 11.9 MB (Top 92.97%)
1 parent d945220 commit f1caa49

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
// Runtime: 15 ms (Top 52.29%) | Memory: 11.9 MB (Top 92.97%)
12
class Solution {
23
public:
34
//iterate over each words[i] and take the sub-string str from s of size equals to words[i].
45
//and compare str with words[i] if both are equal increase count by 1.
5-
int countPrefixes(vector<string>& words, string s)
6+
int countPrefixes(vector<string>& words, string s)
67
{
78
int count=0;
89
for(auto it: words)
910
{
1011
string str = s.substr(0, it.size());
11-
if(str == it) count++;
12+
if(str == it) count++;
1213
}
13-
return count;
14+
return count;
1415
}
15-
};
16+
};

0 commit comments

Comments
 (0)