1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
// @Title: 判断子序列 (Is Subsequence)
// @Author: 15816537946@163.com
// @Date: 2020-06-25 07:15:36
// @Runtime: 16 ms
// @Memory: 6.4 MB
func isSubsequence(s string, t string) bool {
	var i,j int
	for i <len(s) && j < len(t) {
		if s[i] == t[j] {
			i++
		}
		j++
	}

	return i == len(s)
}