edit distance -- memo and dp versions