The problem is given 3 strings I, S, F How many moves (it should be minimum) are needed to transform String I to string S and transform string S to string F.
A move on a string S consists of choosing two integers i, j (0 <= i <= j <= | S |) and inverting this substring. For example: S = ABCDE . If i = 1 and j = 4, the string will be DCBAE
The input consist of 3 strings I, S, F
|I| <= 10 **** |I| = |S| = |F|
abc cba cab
The output should be 2
I was trying to solve it using a BFS but I think it will get TLE because the worst case will exist N! strings and for every string I need to choose two elements to invert
Anyone have any idea how to solve it ? :D