Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Minimize differences solution in Speedy category for Tricky String by Phil15
import operator as op
def tricky_string(text: str, word: str = 'CheckIO') -> str:
n = len(word)
idx = min(range(len(text) - n + 1), key=lambda i: sum(map(op.ne, text[i:i + n], word)))
return text[:idx] + word + text[idx + n:]
Nov. 10, 2023
Comments: