![]() |
Given two strings S and T, and an empty string Z, the task is to print the minimum operations required to make string Z equal to T by appending any subsequence of S at the end of Z. If it is impossible to do so, then print -1. Example:
Approach:
Steps:
Below is the implementation of the above approach: C++
Java
Python3
C#
Javascript
Output
1 Time Complexity: O(n+m), where n is the size of string s and m is the size of string t. |
Reffered: https://www.geeksforgeeks.org
Competitive Programming |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 15 |