![]() |
VOOZH | about |
Given two strings A and B consisting of only lowercase letters, the task is to find the minimum number of subsequences required from A to form B.
Examples:
Input: A = "abbace" B = "acebbaae"
Output: 3
Explanation:
Sub-sequences "ace", "bba", "ae" from string A used to form string BInput: A = "abc" B = "cbacbacba"
Output: 7
Approach:
Below is the implementation of the above approach.
3
Time Complexity: O(N1+N2) // N1 is the length of string A and N2 is the length of string B
Auxiliary Space: O(26)