You are viewing a single comment's thread. Return to all comments →
If someone have problem with test case 10 and (I think) 6 (may be). Then the solution is below.
Here is a twist, If the difference of lengths of s and t are odd and k is even, then it is not possible to convert s to t. eg,
y yu 2
let us look at all the cases for above eg:
op 1:del y from s => s=""; op 2:append y to s => s="y" => s!=t; OR
op 1:append u to s => s="yu"; op 2:del u from s => s="y" => s!=t; OR
op 1:append u to s => s="yu"; op 2:append x(say) to s => s="yux" => s!=t;
Hence, s=t can not be achieved using 2 operations. That's why ans is No
Seems like cookies are disabled on this browser, please enable them to open this website
Append and Delete
You are viewing a single comment's thread. Return to all comments →
If someone have problem with test case 10 and (I think) 6 (may be). Then the solution is below.
Here is a twist, If the difference of lengths of s and t are odd and k is even, then it is not possible to convert s to t. eg,
y yu 2
let us look at all the cases for above eg:
op 1:del y from s => s=""; op 2:append y to s => s="y" => s!=t; OR
op 1:append u to s => s="yu"; op 2:del u from s => s="y" => s!=t; OR
op 1:append u to s => s="yu"; op 2:append x(say) to s => s="yux" => s!=t;
Hence, s=t can not be achieved using 2 operations. That's why ans is No