Check If String Is a Prefix of Array LeetCode solution in C++

1
class Solution {
2
public:
3
bool isPrefixString(string s, vector<string> &words) {
4
string n = "";
5
for (string str : words) {
6
for (char ch : str) {
7
n += ch;
8
}
9
if (n == s) {
10
return true;
11
}
12
}
13

14
return false;
15
}
16
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0