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的更多相关文章

  1. [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 ...

  2. Leetcode392. Is Subsequence

    Description Given a string s and a string t, check if s is subsequence of t. You may assume that the ...

  3. LeetCode392. 判断子序列

    原题链接 1 class Solution: 2 def isSubsequence(self, s: str, t: str) -> bool: 3 lens,lent = len(s),le ...

随机推荐

  1. Solr快速入门

    1. 什么是Solr Solr是基于lucene的全文检索服务器.不同于lucene工具包,solr是一个web应用,运行在servlet容器,屏蔽了底层细节,并对外提供服务. 点我lucene快速入 ...

  2. Linux下的目录结构

    1./ -根 每个文件和目录从根目录开始 只有root用户具有该目录下的写权限,请注意,/root是root用户的主目录,这与/.不一样. 2. /bin  -用户二进制文件 包含二进制可执行的文件 ...

  3. LeetCode OJ:Sqrt(x)(平方根)

    Implement int sqrt(int x). Compute and return the square root of x. 简单的二分法,注意mid应该选为long,否则容易溢出: cla ...

  4. h5启动原生APP总结

    许久没有写博客了,最近有个H5启动APP原生页面的需求,中间遇上一些坑,看了些网上的实现方案,特意来总结下 一.需要判断客户端的平台以及是否在微信浏览器中访问 1.客户端判断 在启动APP时,Andr ...

  5. CABAC与CAVLC有什么区别?

    待完善 7.3.12 用 CAVLC 方式编码的残差数据的语义 coeff_token   指明了非零系数的个数,拖尾系数的个数. trailing_ones_sign_flag 拖尾系数的符号 - ...

  6. android安装apk

     * 安装apk */ private void installApk() { // 获取当前sdcard存储路径 File apkfile = new File(Environment.getE ...

  7. InnoSetup使用笔记

    今天用InnoSetup做安装包时,因为要装的驱动区分32位.64位,64位系统中要安装32位+64位驱动. 想在脚本中进行判断.折腾一阵,终于搞定: 参考了:http://379910987.blo ...

  8. HDU - 6098:Inversion(暴力均摊)

    Give an array A, the index starts from 1. Now we want to know B i =max i∤j A j  Bi=maxi∤jAj , i≥2 i≥ ...

  9. vc++ windows 快速启动栏创建快捷方式

    创建快速启动栏 在windows软件开发中,软件安装过程中总是需要在快速启动栏创建快捷方式,下面介绍一种快速启动栏创建快捷方式的方法,具体代码如下:(该方法不支持win10,目前还没有找到win10的 ...

  10. 脚本工具---自动解析mysql建表语句,生成sqlalchemy表对象声明

    常规建表语句: CREATE TABLE `test_table` ( `id` int(11) NOT NULL, `name` char(64) NOT NULL, `password` char ...