Wednesday, January 29, 2025
Is Subsequence

Updated: January 2025
Is Subsequence
easy
💡 Intuition
- We can iterate through the characters of the main string while keeping track of the index in the subsequence.
- Whenever we find a matching character, we move to the next character in the subsequence.
- If we successfully traverse the entire subsequence, it confirms that it is present in the main string.
🚀 Solution
go
⏳ Time Complexity
- Since we are taking single loop for the array of length n, the time complexity will be
O(n)