INNER CODE UNIT · Java

resultList

robinhood/ticker · ticker/src/main/java/com/robinhood/ticker/LevenshteinUtils.java:187

        final List<Integer> resultList = new ArrayList<>(resultLength * 2);
        int row = numRows - 1;
        int col = numCols - 1;
        while (row > 0 || col > 0) {
            if (row == 0) {
                // At the top row, can only move left, meaning insert column
                resultList.add(ACTION_INSERT);
                col--;
            } else if (col == 0) {
                // At the left column, can only move up, meaning delete column
                resultList.add(ACTION_DELETE);
                row--;
            } else {
                final int insert = matrix[row][col-1];
                final int delete = matrix[row-1][col];
                final int replace = matrix[row-1][col-1];

                if (insert < delete && insert < replace) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…