New answers tagged


According to wikipedia, deletion, insertion, and substitution can assign separate costs. We can simply set substitutions cost to deletion plus insertion, which is 2 if deletion and insertion are both 1. Here is the java code: public static int deleteAddEditDistance(String s1, String s2) { if (s1 == null) { return 0; } else if (s2 == null) { ...

Top 50 recent answers are included