protected List<T> doGetLcs(TaskMonitor monitor) throws CancelledException {

		int x = 0;
		int y = 0;

		if (c.length > 0) {
			x = lengthOfX();
			y = lengthOfY();
		}

		List<T> result = new ArrayList<>();
		while (x > 0 && y > 0) {
			monitor.checkCancelled();

			if (c[x][y] == c[x - 1][y - 1] + 1 && matches(valueOfX(x), valueOfY(y))) {
				result.add(0, valueOfX(x));
				--x;
				--y;
			}
			else if (c[x][y] == c[x - 1][y]) {
				--x;
			}
			else {
				--y;
			}
		}
		return result;
	}
Get the actual LCS based upon the already created matrix

@param monitor the task monitor
@return the LCS list
@throws CancelledException if the monitor is cancelled
Ghidra/Framework/Generic/src/main/java/generic/algorithms/Lcs.java