- 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 do in order to transform line1 into the line2?
- Delete one letter from one of the strings.
- Insert one letter into one of the strings.
- Replace one of the letters in one of the strings with another letter.
Input: Two arguments - two strings.
Output: An int, the 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