Solutions for distance between two strings

    • @MatthewIdete
    • @alexander, submitted in Python 3, achived 100% score
    def solve(s1, s2):
        if s1 == s2:
            return 0
        elif not s1:
            return len(s2)
        elif not s2:
            return len(s1)
        if s1[0] == s2[0]:
            return solve(s1[1:], s2[1:])
        return 1 + min(
            solve(s1[1:], s2),      # deletion from s1
            solve(s1, s2[1:]),      # addition to s1
            solve(s1[1:], s2[1:]))  # modification to s1