Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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".




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: