Amazon interview question

write an algorithm to calculate the edit distance between two strings