Tuesday, February 6, 2018

Being interviewer: Deletion distance and long common subsequences

Feb. 6, 2018

Introduction


It is 8:00 PM mock interview. I had chance to learn a way to solve deletion distance using long common subsequences.

The idea is to find the longest common subsequences in two strings, for example, "heat" and "hit", the common subsequence is "ht", so the distance is "heat" and "hit" length sum minus 2 times length of common subsequence "ht". It is 7 - 2 * 2 = 3.

Code review


Here is Java code.


No comments:

Post a Comment