当前位置:网站首页>力扣 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
边栏推荐
- R语言fpc包的dbscan函数对数据进行密度聚类分析、查看所有样本的聚类标签、table函数计算聚类簇标签与实际标签构成的二维列联表
- R language ggplot2 visualization: use the ggdensity function of ggpubr package to visualize the packet density graph, and use stat_ overlay_ normal_ The density function superimposes the positive dist
- Specify the version of OpenCV non-standard installation
- Compiler optimization (4): inductive variables
- LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
- pom.xml 配置文件标签作用简述
- 华南X99平台打鸡血教程
- R language ggplot2 visualization: use the ggstripchart function of ggpubr package to visualize the dot strip plot, set the position parameter, and configure the separation degree of different grouped
- what‘s the meaning of inference
- 8 CAS
猜你喜欢

Navicat连接2002 - Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘解决

Sword finger offer II 013 Sum of two-dimensional submatrix

Empowering smart power construction | Kirin Xin'an high availability cluster management system to ensure the continuity of users' key businesses

8 CAS

PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!

Matplotlib drawing 3D graphics

ASP. Net kindergarten chain management system source code

【STL】vector
Make this crmeb single merchant wechat mall system popular, so easy to use!

Introduction to bit operation
随机推荐
how to prove compiler‘s correctness
torch. nn. functional. Pad (input, pad, mode= 'constant', value=none) record
2022如何评估与选择低代码开发平台?
R语言ggplot2可视化:使用ggpubr包的ggqqplot函数可视化QQ图(Quantile-Quantile plot)
多个线程之间如何协同
“本真”是什么意思
实训九 网络服务的基本配置
MySQL、sqlserver oracle数据库连接方式
Compiler optimization (4): inductive variables
Boot 和 Cloud 的版本选型
IP tools
[RT thread env tool installation]
ant desgin 多选
Nunjuks template engine
剑指 Offer II 013. 二维子矩阵的和
The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list
R语言ggplot2可视化:使用ggpubr包的ggstripchart函数可视化分组点状条带图(dot strip plot)、设置position参数配置不同分组数据点的分离程度
Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
R语言dplyr包select函数、group_by函数、filter函数和do函数获取dataframe中指定因子变量中指定水平中特定数值数据列的值第三大的值