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. C# List 排序

    (转自:http://www.cnblogs.com/bradwarden/archive/2012/06/19/2554854.html) 第一种:实体类实现IComparable接口,而且必须实现 ...

  2. 图解 ASP.NET Core开发环境准备

    2016年6月28日微软宣布发布 .NET Core 1.0.ASP.NET Core 1.0 和 Entity Framework Core 1.0. .NET Core是微软在两年前发起的开源跨平 ...

  3. css: 基础一

    1.display有哪些值?说明他们的作用 @1.block:设定元素为块级元素,占据一整行,可设置宽高. @2.inline-block: 设定元素行内块元素,可设置宽高,一行能显示多个. @3.i ...

  4. Agilent RF fundamentals (5)

    2考虑两个因素 3 RX 4 TX RX switch use Duplexer

  5. 解决AndroidStudio导入项目在 Building gradle project info 一直卡住

    Android Studio导入项目的时候,一直卡在Building gradle project info这一步,主要原因还是因为被墙的结果.gradle官网虽然可以访问,但是速度连蜗牛都赶不上.. ...

  6. php之opcodes

    opcode是一种php脚本编译之后的语言. 例如: <?php echo "Hello World"; $a = 1 + 1; echo $a; ?> php执行这段 ...

  7. 使用 minio 搭建私有对象存储云。aws-php-sdk 操作object

    How to use AWS SDK for PHP with Minio Server aws-sdk-php is the official AWS SDK for the PHP program ...

  8. 使用iptables nat进行端口转发

    1.将发向HostA:PortA的请求转发到HostB:PortB iptables -t nat -A PREROUTING -p tcp -i eth0 -d HostA --dport Port ...

  9. Bootstrap-table学习笔记(一)

    第一次使用Bootstrap-table这个表格插件,记录一下使用过程中遇到的问题. =================== | 引入CSS文件 <link rel="styleshe ...

  10. C# 浅拷贝与深拷贝(复制)

    在有些时候,我们需要从数据库读取数据填充对象或从硬盘读取文件填充对象,但是这样做相对耗时.这时候我们就想到了对象的拷贝.本文即以实例形式解析了C#浅拷贝和深拷贝的用法. C#中有两种类型变量,一种 是 ...