A spelling helper measures how far a typed word is from a dictionary word. One edit is inserting one character, deleting one character, or replacing one character with another.
Write editSteps(typed, word) that returns the fewest edits that turn typed into word.
Input: typed = "color", word = "colour" Output: 1
Insert u.
Input: typed = "flex", word = "grid" Output: 4
No letters line up, so every letter is replaced.
0 <= typed.length, word.length <= 500Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #536 Edit Steps Between Two Words. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.