Hacker News new | comments | show | ask | jobs | submit login

I trust you will find the following works, based on following the minimal branches of the Levenshtein Algorithm.

"rick", "irkc": remove the final character of "irkc" (insertion)

"rick", "irk": remove the final character of both strings at no cost

"ric", "ir": remove the final character of both strings at a cost of 1 (substitution)

"ri", "i": remove the final character of both strings at no cost

"r", "": base case, cost of 1.

In summary, "rick" -> "rickc" -> "ickc" -> "irkc".




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: