We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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"
Cookie support is required to access HackerRank
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 →
Simple program using single for loop and east to understand
def appendAndDelete(s, t, k):