### AlgoDaily

https://www.algodaily.com

May 24, 2019

Career strategy, tech news, and interview questions in your inbox. A newsletter for the ambitious developer.

#### Words to live by

We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.
- C. A. R. Hoare

#### Today's Lesson:

Beyond the Whiteboard: The Most Common Behavioral Interview Questions

#### AlgoDaily Pick Of the Day:

Land the Perfect Job with LinkedIn

#### Challenge: Levenshtein Edit Distance

An edit distance is a way to quantify how different two strings are. This is calculated using the minimum number of transformations to turn one string to another.

The transformations include `insertion`, `deletion`, and `substitution`. So when comparing two identical strings, the edit distance would be `0`-- there is only an edit distance for differences.

As an example, here's the edit distance for `mitten` and `sitting`:

``````getEditDistance('mitten', 'sitting');
// 3
``````

Here's the rationale in terms of transformation steps:

``````1. mitten -> sitten (substitution of "s" for "m")
2. sitten -> sittin (substitution of "i" for "e")
3. sittin -> sitting (insertion of "g" at the end).
``````