题目描述
Given a string S and another string patt. Find the character in patt that is present at the minimum index in S.
Example 1:
Input: S = "zsyle", patt = "bjz"
Output: "z"
Example 2:
Input: S = "anskg", patt = "me"
Output: "$"
Your Task:
You don't need to read or print anything. Your task is to complete the function printMinIndexChar() which takes S and patt as input parameter and returns the character in patt that is present at the minimum index in S. If not possible returns "$".
Expected Time Complexity: O(max(|str|, |patt|))
Expected Auxilary Space: O(K) where K <= 26
Constraints:
1 ≤ |S|, |patt| ≤ 10^{4}
输入格式
见题面
输出格式
见题面
样例输入
S = "zsyle", patt = "bjz"
样例输出
"z"