当前位置:网站首页>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;
}
}
边栏推荐
- How to extract MP3 audio from MP4 video files?
- [groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
- Ubantu check cudnn and CUDA versions
- Promise
- Zhuhai laboratory ventilation system construction and installation instructions
- Questions about database: (5) query the barcode, location and reader number of each book in the inventory table
- MIT doctoral thesis | robust and reliable intelligent system using neural symbol learning
- [pat (basic level) practice] - [simple mathematics] 1062 simplest fraction
- MYSQL---查询成绩为前5名的学生
- Vulhub vulnerability recurrence 74_ Wordpress
猜你喜欢
After 95, the CV engineer posted the payroll and made up this. It's really fragrant
Five challenges of ads-npu chip architecture design
[groovy] compile time meta programming (AST syntax tree conversion with annotations | define annotations and use groovyasttransformationclass to indicate ast conversion interface | ast conversion inte
Hcip---ipv6 experiment
Opinions on softmax function
The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
Starting from 1.5, build a micro Service Framework - call chain tracking traceid
esxi的安装和使用
Arduino hexapod robot
[groovy] compile time metaprogramming (compile time method injection | method injection using buildfromspec, buildfromstring, buildfromcode)
随机推荐
curlpost-php
Convert binary search tree into cumulative tree (reverse middle order traversal)
Getting started with devkit
Xunrui CMS plug-in automatically collects fake original free plug-ins
Hundreds of lines of code to implement a JSON parser
The basic usage of JMeter BeanShell. The following syntax can only be used in BeanShell
Beginner redis
JVM_ 15_ Concepts related to garbage collection
View class diagram in idea
[groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)
面试必刷算法TOP101之回溯篇 TOP34
Finding the nearest common ancestor of binary tree by recursion
Hcip---ipv6 experiment
新手入门深度学习 | 3-6:优化器optimizers
VSphere implements virtual machine migration
Lone brave man
cf:H. Maximal AND【位运算练习 + k次操作 + 最大And】
小程序容器可以发挥的价值
程序员成长第九篇:真实项目中的注意事项
[groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)