Takefumi Yamamura's blog

This blog is for my memorandum about programming and English.

Happy Coding

This blog is for my memorandum



There are three types of edits that can be performed on strings: insert a character, remove a character, or replace a character. Given two strings, write a function to check if they are one edit (or zero edits) away.

How to solve

Implement three method testing whether the array can be edited by each way. I can check the possibility of each edit by the following way.

  • Insert and Remove This means if we compared the strings they would be identical except for one character and the difference of the length is one.

  • Replace This means that two strings are different only in one place