Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
match changes solution in Clear category for One Switch Strings by Phil15
from itertools import zip_longest
def switch_strings(line: str, result: str) -> bool:
changes = [(s, t) for s, t in zip_longest(line, result) if s != t]
match changes:
case []:
return True
case [a, b]:
return b[::-1] == a
case _:
return False
Nov. 26, 2022
Comments: