If characters are equal , execute recursive function for n - 1 , m - 1
if ( s1 . charAt ( n - 1 ) == s2 . charAt ( m - 1 ) ) { if ( dp [ n - 1 ] [ m - 1 ] == - 1 ) { return dp [ n ] [ m ] = minDis ( s1 , s2 , n - 1 , m - 1 , dp ) ; } else return dp [ n ] [ m ] = dp [ n - 1 ] [ m - 1 ] ; }