Problem
Given 2 strings - s1 and s2, when only 1 operation is allowed - Moving character at a time but only to the first position.
Example
Example 1
Input
s1 = abcd
s2 = bacd
Output
Ans = 1
Reason, just move b forward and we get it.
Example 2
Input
A = (a)b(cd)e(f)g(hij)
B = ahdjcifbeg
Output
Ans =7
Explanation
A = (a)b(cd)e(f)g(hij)
B = ahdjcifbeg
Characters b,e,g are in the order, rest characters have to brought first.
Given 2 strings - s1 and s2, when only 1 operation is allowed - Moving character at a time but only to the first position.
Example
Example 1
Input
s1 = abcd
s2 = bacd
Output
Ans = 1
Reason, just move b forward and we get it.
Example 2
Input
A = (a)b(cd)e(f)g(hij)
B = ahdjcifbeg
Output
Ans =7
Explanation
A = (a)b(cd)e(f)g(hij)
B = ahdjcifbeg
Characters b,e,g are in the order, rest characters have to brought first.
0 comments:
Post a Comment