Notice Period

Typo Repair Bill

medium

A print shop fixes botched engravings character by character. Each repair operation costs one billable unit: insert a character, delete a character, or replace one character with another.

Given the engraved string current and the string the customer ordered, target, return the minimum number of operations to turn current into target.

Example 1
in current = "horse", target = "ros"
out 3
Replace h→r, delete the r that follows, delete the e.
Example 2
in current = "kitten", target = "sitting"
out 3
k→s, e→i, insert g.
Constraints
  • · 0 <= len(current), len(target) <= 50
  • · lowercase letters only
similar problem on LeetCode ↗
solution.pyloading python…
test results
Hit ▶ Run to test your code against the visible cases.