• + 0 comments

    Simple program using single for loop and east to understand

    def appendAndDelete(s, t, k):

    count=0
    for i,j in zip(s,t):
        if i == j:
            count+=1
        else:
            break
    mini=(len(s)-count)+(len(t)-count)
    if len(s)+len(t) <= k or (k >= mini and (k - mini) % 2 == 0):
        return "Yes"
    return "No"