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.
Since you need to make exactly k moves, you have 2 options.
After arriving at a common phrase between s and t perform add-delete pairs to satisfy "even" number of additional moves.
After emptying the string any number of additional moves can be made.
Additional deletes on empty string does not change the string but consumes the move, allowing you to make the change from abc to abc in any moves more than 6.
k values 1, 3, 5 should return No.
Append and Delete
You are viewing a single comment's thread. Return to all comments →
Since you need to make exactly
k
moves, you have 2 options.After arriving at a common phrase between
s
andt
perform add-delete pairs to satisfy "even" number of additional moves.After emptying the string any number of additional moves can be made.
Additional deletes on empty string does not change the string but consumes the move, allowing you to make the change from
abc
toabc
in any moves more than 6.k
values 1, 3, 5 should returnNo
.Hope this helps.