【LeetCode】392. Is Subsequence

字符串序列判定(100%用例)C卷 (Java&&Python&&Node.js&&C语言&&C++) 输入两个字符串 S 和 L ,都只包含英文小写字母。S 长度 阅读详情

392. Is Subsequence

Given a string s and a string t, check if s is subsequence of t.

You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100).

A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ace" is a subsequence of "abcde" while "aec" is not).

Example 1:
s = "abc", t = "ahbgdc"

Return true.

Example 2:
s = "axc", t = "ahbgdc"

Return false.

Follow up:
If there are lots of incoming S, say S1, S2, ... , Sk where k >= 1B, and you want to check one by one to see if T has its subsequence. In this scenario, how would you change your code?

Credits:
Special thanks to @pbrother for adding this problem and creating all test cases.

class Solution {
public:
    bool isSubsequence(string s, string t) {
        int idx = 0;
        for (int i = 0; i < t.size(); i++) {
            if (s[idx] == t[i]) {
                idx++;
            }
        }
        return idx == s.size();
    }
};

 

随机截距交叉滞后模型RI-CLPM:原理、Mplus实现与结果解读 纵向面板数据分析中,传统交叉滞后模型(CLPM)常被用于探索变量间的时序关系,但其估计结果可能混淆了个体间稳定差异与个体内短期波动,导致交叉滞后路径出现偏差。随机截距交叉滞后模型(RI-CLPM)通过引入随机截距因子,将个体特质层面的差异与个体内动态过程分离,从而提供更纯净的个体内效应估计。该模型在组织心理学、发展心理学、成瘾行为等研究领域迅速普及,并成为顶级期刊审稿时常见的稳健性检验要求。本文从原理出发,系统讲解RI-CLPM的模型构建、识别条件、Mplus实操代码、输出解读及常见陷阱,并结合协变量处理、 阅读详情

相关推荐

【AI实战】用Coze工作流打造抖音视频文案提取神器——从单链接到批量处理的进阶指南

本文详细介绍了如何利用Coze工作流打造抖音视频文案提取工具,从单链接处理到批量提取的进阶指南。通过AI技术和工作流的结合,用户可以高效提取抖音视频的ASR和OCR文本,大幅提升内容创作效率。文章还涵盖了性能优化、异常处理及实际应用场景扩展,助力开发者快速实现抖音文案自动化提取。

weixin_29210759的博客 284

【JS】判断是不是字符串子序列

定两个字符串 s和 t ,判断 s是否为 t 的子序列。 你可以认为 s 和 t 中仅包含英文小写字母。字符串 t 可能会很长(长度n ~= 500,000),而 s 是个短字符串(长度

倏存的博客 552

ADS Layout设计实战:从参数设置到协同仿真

本文详细介绍了ADS Layout设计的完整实战流程,从新建工程、单位设置、个性化偏好配置等基础操作入手,逐步深入到基板参数配置、端口设置与电磁仿真器选择等核心环节。重点阐述了参数化版图设计与扫描优化、以及原理图与Layout协同仿真的高级技巧,并通过一个微带线低通滤波器设计案例,完整演示了从理论到实现的闭环设计方法,帮助工程师高效、准确地完成高频电路版图设计与验证。

weixin_29268637的博客 807

字符串序列判定

S 中的每个字符在 L 中都能找到(可以不连续),且 S 在L中字符的前后顺序与 S 中顺序要保持一致。输入两个字符串 S 和 L,都只包含英文小写字母。`S 长度

南京大学软件工程硕士在读 1145

森林冰火人html源码,森林冰火人单人版(源码)

【实例简介】java小游戏——森林冰火人,单人游戏, 实现人物行走,跳跃,吃水晶,具有计时功能,积分功能,倒计时结束游戏失败。【实例截图】【核心代码】森林冰火人单人版├── bin│ ├── game│ │ ├── Help.class│ │ ├── Logon.class│ │ ├── Main.class│ │ ├── Mykey.class│ │ ...

weixin_42507981的博客 6212

动态表单设计

自定一表单数据结构。内容展示如有必要行转列。前端根据题目类型自定义组件后端跟俊题目类型用策略模式校验各种类型这样有统计功能的简单动态问卷就可以了展示时可能某些场景需要行转列。大概估摸使用的话有可能kmic_form_data_detail表的记录数比较大,后期再考虑数据或者表迁移或拆分。

zquwei的博客 3494

Leetcode 392.判断子序列(Is Subsequence)

Leetcode 392.判断子序列 1 题目描述(Leetcode题目链接)   给定字符串 s 和 t ,判断 s 是否为 t 的子序列。 你可以认为 s 和 t 中仅包含英文小写字母。字符串 t 可能会很长(长度 ~= 500,000),而 s 是个短字符串(长度 <=100)。 字符串的一个子序列是原始字符串删除一些(也可以不删除)字符而不改变剩余字符相对位置形成的新字符串。(例如,"ace"是"abcde"的一个子序列,而"aec"不是)。 示例 1: s = “abc”, t = “ahb

qq_39378221的博客 215

【OpenClaw从入门到精通】第66篇:Skill开发进阶——从零打造一个跨境选品Skill(附完整代码)(2026实测版)

2026年跨境电商效率革命中,AI Agent已成为选品核心工具,但通用Skill难以适配个性化需求。本文以“跨境选品”为实战场景,从零讲解OpenClaw Skill的完整开发流程:从需求分析、目录结构设计、SKILL.md编写,到Python脚本开发(含1688商品搜索、销量分析、竞品对比核心功能),再到调试测试、安全审计与ClawHub发布。文中提供可直接复制的完整代码,覆盖多平台适配、异常处理、数据可视化等进阶功能,同时解决API调用、链接失效等实际问题。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 574

leetcode 392. Is Subsequence

难度:Medium Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~=

SeanBollock1的博客 405

基于STM32设计的智能手环(ESP8266+华为云IOT)_178

为了满足用户对健康监测的需求,手环项目集成了血氧检测、心率检测、体温检测等功能。这些功能采用了专门的传感器模块,如MAX30102、DS18B20等,确保了测量数据的准确性和可靠性。同时,为了方便用户了解自己的运动情况,项目还加入了行走步数统计功能,通过MPU6050模块实现精确计步。

2410

Python爬虫实战:利用Playwright和反反爬技术高效抓取Bloomberg金融数据

用户行为分析(鼠标移动、点击模式)请求头检测IP频率限制WebSocket通信验证Canvas指纹识别我们的爬虫需要模拟人类行为,使用代理IP池,并合理控制请求频率。

2201_76125261的博客 1022

Leetcode 392. Is Subsequence

Leetcode 392. Is Subsequence Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long ...

fengran_mark的博客 176

基于咸鱼最新九宫格图标验证码的语义增强模型识别

本文探讨了破解复杂验证码的技术思路,重点分析了某平台的九宫格验证码应对策略。作者提出通过图像语义抽取和增强技术来扩充数据集:先采集少量真实样本,利用形态学操作进行前增强生成变形图像,再通过叠加背景噪声进行后增强。同时强调真实数据集的重要性,建议采用真实+生成数据的混合训练方法。实验表明该方法可使模型准确率达到95%以上,但作者特别声明本文仅供技术研究,严禁用于非法用途。

码王吴彦祖的博客 607

LeetCode OJ-392.Is Subsequence

LeetCode OJ-392.Is Subsequence题目描述 Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially

oYinGui1 688

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

LeetCode: 392. Is Subsequence

题目: LeetCode: 392. Is Subsequence(https://leetcode.com/problems/is-subsequence/description/) class Solution { public boolean isSubsequence(String s, String t) { int currentLoc = 0; byte[] byte...

majinliang1234的博客 200

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Leetcode 392 Is Subsequence

Leetcode 392 Is SubsequenceDescriptioniven a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a v

Zeongwan的博客 283

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

LeetCode //C - 392. Is Subsequence

【代码】LeetCode //C - 392. Is Subsequence。

Made in Code 1025

【Leetcode】392. Is Subsequence

【代码】【Leetcode】392. Is Subsequence。

数学、算法爱好者的博客 188

LeetCode 392. Is Subsequence

392. Is SubsequenceGiven a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~=

mingjc的博客 347

[leetcode]392. Is Subsequence

[leetcode]392. Is Subsequence Analysis 早鸭—— [每天刷题并不难0.0] Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and...

weixin_32135877的博客 167

LeetCode 392 Is Subsequence

Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string,

几百个测试用例一致通过 251

【LeetCode】392. Is Subsequence

题目: Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,0

gmr_vhp的博客 348

LeetCode 392. Is Subsequence 解题报告

LeetCode 392. Is Subsequence 解题报告

骆小坑的填坑之旅 1430

LeetCode 392 is subsequence

脑子秀逗了,看过的题目做的时候还是会忘记。晚上笔试的时候遇到判断是否为字符子串的问题。其实自己之前就在LeetCode上做过,但是!!!丝毫!!没有印象!!!而且!!!这道题很简单的啊!小拳拳锤我胸口! 下面进入正题: Given a string s and a string t, check if s is subsequence of t. You may ass...

暗时间 240
上一篇: 【LeetCode】455. Assign Cookies
下一篇: 马的遍历(回溯+DFS)
coderwait
博客等级 码龄9年 20粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址