当前位置:网站首页>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;
}
}
边栏推荐
- After Luke zettlemoyer, head of meta AI Seattle research | trillion parameters, will the large model continue to grow?
- WordPress collection plug-in automatically collects fake original free plug-ins
- [groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
- [Arduino syntax - structure]
- 看抖音直播Beyond演唱会有感
- ORA-00030
- synchronized 和 ReentrantLock
- Modify the ssh server access port number
- 282. Stone consolidation (interval DP)
- MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
猜你喜欢
Recommended areas - ways to explore users' future interests
servlet(1)
《强化学习周刊》第52期:Depth-CUPRL、DistSPECTRL & Double Deep Q-Network
JVM_ 15_ Concepts related to garbage collection
关于#数据库#的问题:(5)查询库存表中每本书的条码、位置和借阅的读者编号
cf:C. The Third Problem【关于排列这件事】
MIT doctoral thesis | robust and reliable intelligent system using neural symbol learning
Installation and use of esxi
2020.2.13
Building core knowledge points
随机推荐
Recoverable fuse characteristic test
【第30天】给定一个整数 n ,求它的因数之和
激动人心,2022开放原子全球开源峰会报名火热开启
The value of applet containers
孤勇者
[groovy] compile time metaprogramming (compile time method injection | method injection using buildfromspec, buildfromstring, buildfromcode)
Exciting, 2022 open atom global open source summit registration is hot
关于softmax函数的见解
视频直播源码,实现本地存储搜索历史记录
Cf:c. the third problem
Four commonly used techniques for anti aliasing
SAP Spartacus home 页面读取 product 数据的请求的 population 逻辑
1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
IP storage and query in MySQL
In the era of industrial Internet, we will achieve enough development by relying on large industrial categories
面试必刷算法TOP101之回溯篇 TOP34
MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
Cannot resolve symbol error
MYSQL GROUP_ The concat function realizes the content merging of the same ID
Recursive method to realize the insertion operation in binary search tree