leetcode392
public class Solution {
public bool IsSubsequence(string s, string t) {
var i = ;
var j = ;
while (i < s.Length && j < t.Length)
{
if (s[i] == t[j])
{
i++;
j++;
}
else
{
j++;
}
} if (i >= s.Length)
{
return true;
}
else
{
return false;
}
}
}
https://leetcode.com/problems/is-subsequence/#/description
leetcode392的更多相关文章
- [Swift]LeetCode392. 判断子序列 | Is Subsequence
Given a string s and a string t, check if s is subsequence of t. You may assume that there is only l ...
- Leetcode392. Is Subsequence
Description Given a string s and a string t, check if s is subsequence of t. You may assume that the ...
- LeetCode392. 判断子序列
原题链接 1 class Solution: 2 def isSubsequence(self, s: str, t: str) -> bool: 3 lens,lent = len(s),le ...
随机推荐
- 【scala】apply和update
我们在使用scala的时候经常会用到对象的apply方法和update方法. 虽然我们表面没有察觉,但是实际上两个方法都会遵循相关约定被调用. apply apply方法的约定:用括号传递给变量(对象 ...
- Ti CC2540蓝牙模块学习笔记整理
接触CC2540几天,终于有了初步的理解,现将笔记整理如下,只是皮毛,如有错误,还请指正,还有好多没闹明白的地方,以后应该还会继续向里面更新~ 一.整体 1.TI的蓝牙平台支持2种协议栈/应用配置:单 ...
- set, map, string, find(), string name[100],等的混合
Unrequited Love Time Limit: 16 Seconds Memory Limit: 131072 KB There are n single boys and m si ...
- python基础之多线程与多进程(二)
上课笔记整理: 守护线程的作用,起到监听的作用 一个函数连接数据库 一个做守护线程,监听日志 两个线程同时取一个数据 线程---->线程安全---->线程同时进行操作数据. IO操作--- ...
- h5使用模块模板,循环输出模块列表
博主使用freemarker为框架,不过不影响功能的说明,首先来看看成品效果图 然后是html [#import "/common/layout.ftl" as layout] [ ...
- 2017.11.23 display fun --STM8
unsigned char disp_mode;unsigned char disp_last_mode;unsigned char disp_sub_mode;unsigned char disp_ ...
- pg limit限制返回的行
limit 20:返回结果集中的前20行 offset 20 limit 20:返回结果集中前40行中的后20行 示例: 创建测试表: postgres=# create table test_lim ...
- c++11新特性之宽窄字符转换
C++11增加了unicode字面量的支持,可以通过L来定义宽字符:str::wstring str = L"中国人": 将宽字符转换为窄字符串需要用到codecvt库中的std: ...
- ArcGIS Runtime SDK for WPF之测量距离和面积
bu不多说,上代码 using System.Windows; using ESRI.ArcGIS.Client; using ESRI.ArcGIS.Client.Tasks; using ESRI ...
- 笔记:LIR2032 电池充电记录
笔记:LIR2032 电池充电记录 LIR2032 电池是锂电池,形状和 CR2032 一样,只不过可以充电,材料是锂离子. 一个单颗的 LIR2032 电池容量只有 40mAH,容量很小. 那么就需 ...