INNER CODE UNIT · Java
resultLength
robinhood/ticker · ticker/src/main/java/com/robinhood/ticker/LevenshteinUtils.java:153
final int resultLength = Math.max(sourceLength, targetLength);
if (sourceLength == targetLength) {
// No modifications needed if the length of the strings are the same
fillWithActions(columnActions, resultLength, ACTION_SAME);
return;
}
final int numRows = sourceLength + 1;
final int numCols = targetLength + 1;
// Compute the Levenshtein matrix
final int[][] matrix = new int[numRows][numCols];
for (int i = 0; i < numRows; i++) {
matrix[i][0] = i;
}
for (int j = 0; j < numCols; j++) {