Company: Ibm_23sep
Difficulty: medium
Minimum Cost String Transformation Problem Description Given two strings s and t , determine the minimum total cost required to transform s into t using the following operation any number of times, including zero: Select an index i such that 0 ≤ i < length of s . Remove the character at index i . Concatenate the remaining characters in order. The step costs i units. If the transformation is not possible, return -1 . Examples Example 1: Input: s = "abacc", t = "aba" Output: 6 Explanation: To transform "abacc" into "aba": The underlined character is removed in the step. Step 1: From s = "abacc" , choose index i = 3 (the first 'c'). Remove it. The cost is 3 units. s becomes "abac" . Step 2: From s = "abac" , choose index i = 3 (the second 'c'). Remove it. The cost is 3 units. s becomes "aba" . Total cost = 3 + 3 = 6. Example 2: Input: s = "abcde", t = "acx" Output: -1 Explanation: It is not possible to match the 'x' in t , as 'x' is not present in s or cannot be formed by removing c