• + 0 comments

    python:

    def appendAndDelete(s, t, k):
        # Write your code here
        if len(s)+len(t)<=k:
            return 'Yes'
        i = 0
        while i < min(len(s), len(t)) and s[i] == t[i]:
            i += 1
        root_index = i
        delta = len(s) - root_index
        chars_to_add = len(t) - root_index
        remaining_ops = k-(delta+chars_to_add)
        if remaining_ops>=0 and remaining_ops%2==0: 
            return 'Yes'
        else: 
            return 'No'