test: EditDistanceTest (#5397)

This commit is contained in:
Alex Klymenko
2024-08-26 08:48:30 +02:00
committed by GitHub
parent cdb6412601
commit be6b0d835b
2 changed files with 15 additions and 15 deletions

View File

@ -1,6 +1,5 @@
package com.thealgorithms.dynamicprogramming;
import java.util.Scanner;
/**
* A DynamicProgramming based solution for Edit Distance problem In Java
* Description of Edit Distance with an Example:
@ -68,20 +67,6 @@ public final class EditDistance {
return dp[len1][len2];
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String s1;
String s2;
System.out.println("Enter the First String");
s1 = input.nextLine();
System.out.println("Enter the Second String");
s2 = input.nextLine();
// ans stores the final Edit Distance between the two strings
int ans = minDistance(s1, s2);
System.out.println("The minimum Edit Distance between \"" + s1 + "\" and \"" + s2 + "\" is " + ans);
input.close();
}
// edit distance problem
public static int editDistance(String s1, String s2) {
int[][] storage = new int[s1.length() + 1][s2.length() + 1];