Loading
Loading
An autocorrect feature ranks suggestions by how many keystroke fixes separate a typed word from a dictionary word. One fix is inserting a character, deleting a character, or replacing one character with another.
Return the fewest fixes that turn source into target.
source = "flask", target = "flock"f = f, l = lno costa → oreplace: 1s → creplace: 2k = ktotal 22Sign in to keep a note here. It is free, and nobody else can see it.
Sign inExample 1
Sign in to open hints.
Struggling is where the learning happens. Open this once you have genuinely tried, or once the hints have run out.
O(m × n) time · O(n) space
Input. Run your code to watch it work on this input, one line at a time.
Running code is turned off on this deployment. You can still read the problem, write code, use hints and the visualizer.
Tab moves focus out of the editor. Press Ctrl+M to let Tab indent instead.
No results yet
Run your code against the sample tests, or submit to run the full suite.
Replace a with o and s with c.
Example 2
Delete the final y.
Example 3
Insert all three characters.