We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Basically, I remove characters from the end of s until t starts with s and the number of missing characters to get to t is the number of operations left. I also break if there are no more operations or if s became empty. Afterwards I simply check whether I have enough operations left to add character to s to reach t.
Append and Delete
You are viewing a single comment's thread. Return to all comments →
Quite a compact solution in Python.
Basically, I remove characters from the end of s until t starts with s and the number of missing characters to get to t is the number of operations left. I also break if there are no more operations or if s became empty. Afterwards I simply check whether I have enough operations left to add character to s to reach t.