(i,j,s1=s1,s2=s2)
| 7 | def minDistance(self, s1: str, s2: str) -> int: |
| 8 | @lru_cache(None) |
| 9 | def editdistance(i,j,s1=s1,s2=s2): |
| 10 | if not i: |
| 11 | return j |
| 12 | if not j: |
| 13 | return i |
| 14 | if s1[i-1]==s2[j-1]: |
| 15 | return editdistance(i-1,j-1) |
| 16 | else: |
| 17 | return 1 + min(editdistance(i-1,j),editdistance(i,j-1),editdistance(i-1,j-1)) |
| 18 | # Insert,Delete,replace |
| 19 | return editdistance(len(s1),len(s2),s1,s2) |
nothing calls this directly
no outgoing calls
no test coverage detected