当前位置:网站首页>Leetcode1961. 检查字符串是否为数组前缀
Leetcode1961. 检查字符串是否为数组前缀
2022-07-06 01:10:00 【May Hacker】
https://leetcode.cn/problems/check-if-string-is-a-prefix-of-array/
Java AC
class Solution {
public boolean isPrefixString(String s, String[] words) {
int index = 0;
for(int i=0;i<words.length;i++){
String str = words[i];
for(int j=0;j<str.length();j++){
if(index>=s.length() || str.charAt(j)!=s.charAt(index++)){
return false;
}
}
if(index==s.length()){
return true;
}
}
return false;
}
}
边栏推荐
- VMware Tools installation error: unable to automatically install vsock driver
- The detailed page returns to the list and retains the original position of the scroll bar
- Interview must brush algorithm top101 backtracking article top34
- Differences between standard library functions and operators
- golang mqtt/stomp/nats/amqp
- 孤勇者
- Recoverable fuse characteristic test
- Novice entry depth learning | 3-6: optimizer optimizers
- View class diagram in idea
- Modify the ssh server access port number
猜你喜欢
MYSQL GROUP_ The concat function realizes the content merging of the same ID
MIT doctoral thesis | robust and reliable intelligent system using neural symbol learning
Dedecms plug-in free SEO plug-in summary
Finding the nearest common ancestor of binary tree by recursion
Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]
Mlsys 2020 | fedprox: Federation optimization of heterogeneous networks
What is the most suitable book for programmers to engage in open source?
Intensive learning weekly, issue 52: depth cuprl, distspectrl & double deep q-network
File upload vulnerability test based on DVWA
cf:C. The Third Problem【关于排列这件事】
随机推荐
猿桌派第三季开播在即,打开出海浪潮下的开发者新视野
BiShe - College Student Association Management System Based on SSM
C language programming (Chapter 6 functions)
Who knows how to modify the data type accuracy of the columns in the database table of Damon
朝招金安全吗 会不会亏损本金
[groovy] compile time metaprogramming (compile time method injection | method injection using buildfromspec, buildfromstring, buildfromcode)
Modify the ssh server access port number
Unity | 实现面部驱动的两种方式
[groovy] JSON serialization (convert class objects to JSON strings | convert using jsonbuilder | convert using jsonoutput | format JSON strings for output)
Cf:c. the third problem
图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
Cve-2017-11882 reappearance
Cannot resolve symbol error
DD's command
Novice entry depth learning | 3-6: optimizer optimizers
After Luke zettlemoyer, head of meta AI Seattle research | trillion parameters, will the large model continue to grow?
Why can't mathematics give machine consciousness
SAP Spartacus home 页面读取 product 数据的请求的 population 逻辑
Paging of a scratch (page turning processing)
CTF daily question day44 rot