You are viewing a single comment's thread. Return to all comments →
def appendAndDelete(s, t, k): prefix_count = 0 len_s = len(s) len_t = len(t) while prefix_count < len(t): if prefix_count > (len_s - 1) or s[prefix_count] != t[prefix_count]: break else: prefix_count += 1 delete_required = len_s - prefix_count addition_required = len_t - prefix_count total_ops_required = delete_required + addition_required if k >= (len_s + len_t): return "Yes" if k >= total_ops_required and (k - total_ops_required) % 2 == 0: return "Yes" 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 →