首页 > TAG信息列表 > isSubsequence

392.判断子序列

class Solution { public: bool isSubsequence(string s, string t) { if(s.size() >t.size()){ return false; } if(s.size()==0){ return true; } int l=0,r=0; while(l<s.size() &

leetcode392.判断子序列

func isSubsequence(s string, t string) bool { if len(s)>len(t){ return false } if(len(s)==0){ return true } l,r:=0,0 for l<len(s) && r<len(t){ //没有找到对应数值 遍历数组t //注意下&&两个条件顺序 一个一旦不满

Leetcode 392: Is Subsequence

问题描述: Given two strings s and t, check if s is a subsequence of t. A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the rema