- Oh. This new generation of robots is trying to do everything faster than is needed.
- Come on!! Gaffer! Can I just replace a string and that's all.
- No, young man. You can’t “just replace a string”. You should respect your memory cards, even though you have a lot of them. Now sit and think a little bit. How can this string can be replaced in a most efficient way?
- Ok ok. As you wish. Now I should respect even my own hardware.
You are given two strings, line1 and line2. Answer, what is the smallest number of operations you need to transform line1 to line2?
- Delete one letter from one of strings
- Insert one letter into one of strings
- Replace one of letters from one of strings with another letter
Input: two arguments, two strings.
Output: int, minimum number of operations.
steps_to_convert('line1', 'line1') == 0 steps_to_convert('line1', 'line2') == 1 steps_to_convert('ine', 'line2') == 2
Precondition: 0 <= len(line) < 100