Is Subsequence LeetCode solution in C++
1class Solution {2public:3bool isSubsequence(string s, string t) {4int n = s.length(), m = t.length();5int j = 0;6// For index of s (or subsequence78// Traverse s and t, and9// compare current character10// of s with first unmatched char11// of t, if matched12// then move ahead in s13for (int i = 0; i < m and j < n; i++)14if (s[j] == t[i]) j++;1516// If all characters of s were found in t17return (j == n);18}19};