Hackerrank | Append and Delete

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

Comments

Popular posts from this blog

Hackerrank | Sequence Equation

HackerRank | Organizing Containers of Balls

HackerRank | Minimum Distances