You are given two strings `s` and `t` of lowercase English letters. Return the minimum number of characters that need to be appended to the end of `s` so that `t` becomes a subsequence of `s`. A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.
You are given two strings s and t of lowercase English letters. Return the minimum number of characters that need to be appended to the end of s so that t becomes a subsequence of s. A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.
Example 1:
Input: {"s":"coaching","t":"coding"}
Output: 4
Constraints:
1≤s.length,t.length≤105
s and t consist only of lowercase English letters.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"s":"coaching","t":"coding"}
j = 0 points at t[0] = 'c', the next letter of t we still need to find in s.
s, scanned once by i (green = used for a letter of t)