image_2021-10-25_15-37-39.png
29.8 KB
#N1961. Check If String Is a Prefix of Array
problem link=>https://leetcode.com/problems/check-if-string-is-a-prefix-of-array/
#solution
problem link=>https://leetcode.com/problems/check-if-string-is-a-prefix-of-array/
#solution
class Solution {
public boolean isPrefixString(String s, String[] words) {
String allWords="";
for(int i=0; i<words.length; i++){
allWords+=words[i];
if(allWords.equals(s))
return true;
}
return false;
}
}