<awangdev>K Edit Distance_1.java
private boolean validate(String word, String target, int k) {

        if (word.equals(target)) {
            return true;
        }
        if (Math.abs(word.length() - target.length()) > k) {
            return false;
        }
        
        int m = word.length();
        int n = target.length();
        
        int[][] dp = new int[2][n + 1];
        
        for (int i = 0; i <= m; i++) {
            for (int j = 0; j <= n; j++) {
                if (i == 0) {
                    dp[i % 2][j] = j;
                    continue;
                }
                if (j == 0) {
                    dp[i % 2][j] = i;
                    continue;
                }
                
                dp[i % 2][j] = Math.min(dp[(i - 1) % 2][j - 1], Math.min(dp[i % 2][j - 1], dp[(i - 1) % 2][j])) + 1;
                if (word.charAt(i - 1) == target.charAt(j - 1)) {
                    dp[i % 2][j] = Math.min(dp[i % 2][j], dp[(i - 1) % 2][j - 1]);
                }
            }
        }
        return dp[m % 2][n] <= k;
    }
private boolean var_0 ( String var_2 , String var_3 , int var_4 ) {
  if ( var_2 . equals ( var_3 ) ) {
    return true ;
  }
  if ( Math . abs ( var_2 . length ( ) - var_3 . length ( ) ) > var_4 ) {
    return false ;
  }
  int var_9 = var_2 . length ( ) ;
  int var_10 = var_3 . length ( ) ;
  int [ ] [ ] var_13 = new int [ 2 ] [ var_10 + 1 ] ;
  for ( int var_15 = 0 ;
  var_15 <= var_9 ;
  var_15 ++ ) {
    for ( int var_16 = 0 ;
    var_16 <= var_10 ;
    var_16 ++ ) {
      if ( var_15 == 0 ) {
        var_13 [ var_15 % 2 ] [ var_16 ] = var_16 ;
        continue ;
      }
      if ( var_16 == 0 ) {
        var_13 [ var_15 % 2 ] [ var_16 ] = var_15 ;
        continue ;
      }
      var_13 [ var_15 % 2 ] [ var_16 ] = Math . min ( var_13 [ ( var_15 - 1 ) % 2 ] [ var_16 - 1 ] , Math . min ( var_13 [ var_15 % 2 ] [ var_16 - 1 ] , var_13 [ ( var_15 - 1 ) % 2 ] [ var_16 ] ) ) + 1 ;
      if ( var_2 . charAt ( var_15 - 1 ) == var_3 . charAt ( var_16 - 1 ) ) {
        var_13 [ var_15 % 2 ] [ var_16 ] = Math . min ( var_13 [ var_15 % 2 ] [ var_16 ] , var_13 [ ( var_15 - 1 ) % 2 ] [ var_16 - 1 ] ) ;
      }
    }
  }
  return var_13 [ var_9 % 2 ] [ var_10 ] <= var_4 ;
}
