package
0.0.0-20241220224003-b7cf03a90b2b
Repository: https://github.com/szhou12/leetcode-go.git
Documentation: pkg.go.dev
# README
392. Is Subsequence
Solution idea
Greedy Algorithm: 直接按顺序检查是否所有必要的characters都存在
Time complexity = $O(\max {m, n})$ where $m$ is length of s
, n is length of t
Binary Search:
记录t
中每个char的index,再对s
的每个char进行binary search to find the smallest value > target
Time complexity = $O(m\log n)$