Pattern Hidden in a Stream
An event stream is recorded as the string text, one character per event. A monitoring rule fires when the characters of pattern appear in text in the same order, though not necessarily next to each other.
Return true if pattern is a subsequence of text. An empty pattern always matches.
Example 1
Input: pattern = "ace", text = "abcde" Output: true
Example 2
Input: pattern = "aec", text = "abcde" Output: false Explanation: The `c` would have to come after the `e`.
Constraints
- 0 <= pattern.length <= 100
- 0 <= text.length <= 10^5
Hint 1
Keep one pointer into pattern and advance it whenever the stream shows the character it is waiting for.
Good practice for: Frontend Developer, Backend Developer, Full Stack Developer, Mobile App Developer, Automation Test Engineer, Data Engineer
Run checks your code on 2 sample tests. Submit runs all 7 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.