当前位置:网站首页>力扣 1961. 检查字符串是否为数组前缀
力扣 1961. 检查字符串是否为数组前缀
2022-07-07 17:53:00 【Tomorrowave】
1961. 检查字符串是否为数组前缀
给你一个字符串 s 和一个字符串数组 words ,请你判断 s 是否为 words 的 前缀字符串 。
字符串 s 要成为 words 的 前缀字符串 ,需要满足:s 可以由 words 中的前 k(k 为 正数 )个字符串按顺序相连得到,且 k 不超过 words.length 。
如果 s 是 words 的 前缀字符串 ,返回 true ;否则,返回 false 。
代码部分
class Solution:
def isPrefixString(self, s: str, words: List[str]) -> bool:
b=''
for i in range(len(words)):
b+=words[i]
if b==s:
return True
return False
边栏推荐
- LeetCode 648(C#)
- R语言dplyr包mutate_at函数和min_rank函数计算dataframe中指定数据列的排序序号值、名次值、将最大值的rank值赋值为1
- Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
- L1-027 rental (Lua)
- R language ggplot2 visualization: use the ggecdf function of ggpubr package to visualize the grouping experience cumulative density distribution function curve, and the linetype parameter to specify t
- MSE API学习
- Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
- Kubernetes——kubectl命令行工具用法详解
- 浏览积分设置的目的
- 831. KMP字符串
猜你喜欢
九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
最多可以参加的会议数目[贪心 + 优先队列]
Sword finger offer II 013 Sum of two-dimensional submatrix
Automatic classification of defective photovoltaic module cells in electroluminescence images-論文閱讀筆記
LeetCode_ 7_ five
LeetCode_7_5
8 CAS
J ü rgen schmidhub reviews the 25th anniversary of LSTM papers: long short term memory All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversar
Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.
Download from MySQL official website: mysql8 for Linux X Version (Graphic explanation)
随机推荐
How to buy stocks on your mobile phone and open an account? Is it safe to open an account
九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
8 CAS
Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决
L1-027 rental (Lua)
剑指 Offer II 013. 二维子矩阵的和
RESTAPI 版本控制策略【eolink 翻译】
What does "true" mean
R language ggplot2 visualization: use the ggqqplot function of ggpubr package to visualize the QQ graph (Quantitative quantitative plot)
J ü rgen schmidhub reviews the 25th anniversary of LSTM papers: long short term memory All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversar
9 原子操作类之18罗汉增强
Kunpeng developer summit 2022 | Kirin Xin'an and Kunpeng jointly build a new ecosystem of computing industry
[sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
what‘s the meaning of inference
LC: string conversion integer (ATOI) + appearance sequence + longest common prefix
openEuler 有奖捉虫活动,来参与一下?
The research group of the Hunan Organizing Committee of the 24th China Association for science and technology visited Kirin Xin'an
PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!
mysql 的一些重要知识