You are viewing a single comment's thread. Return to all comments →
my js approach, quite different but almost same
function appendAndDelete(s, t, k) { var end = 0; for (var i = 0; i < Math.min(t.length, s.length); i++) { if (s[i] == t[i]) { end++; } else { break; } } var maxIter = s.length + t.length; var minIter = maxIter - (2 * end); if ((k >= minIter) & ((k - minIter) % 2 == 0)) { return "Yes"; } else if (k >= maxIter) { return "Yes"; } else { return "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 →
my js approach, quite different but almost same