Learner Level
Implement the isSubsequenceText method that checks whether the smaller text appears as a subsequence inside the larger text.
The input contains two strings: small and large. Your task is to check whether small is a subsequence of large.
A subsequence keeps the original order of characters but may skip some characters. For example, abc is a subsequence of ahbgdc because a, b, and c appear in the same order.
Use two pointers: one pointer for small and one pointer for large.
Move through large. When the current character matches the needed character from small, move the small pointer. If all characters of small are matched, return true.
Pseudocode:
function isSubsequenceText(small, large):
i = 0
for each character in large:
if i < length(small) and character == small[i]:
i++
if i == length(small):
return true
return i == length(small)