private void calculateLCS(TaskMonitor monitor) throws CancelledException {
		if (c != null) {
			return;
		}

		if (tooBig()) {
			c = new int[0][0];
			return;
		}

		int[][] tempC = new int[lengthOfX() + 1][];

		monitor.setMessage("Calculating LCS...");
		monitor.initialize(tempC.length);

		// create the zero-initialized matrix
		for (int i = 0; i < tempC.length; i++) {
			tempC[i] = new int[lengthOfY() + 1];
		}

		for (int i = 1; i < tempC.length; i++) {
			monitor.checkCancelled();
			for (int j = 1; j < tempC[i].length; j++) {
				if (matches(valueOfX(i), valueOfY(j))) {
					tempC[i][j] = tempC[i - 1][j - 1] + 1;
				}
				else {
					tempC[i][j] = Math.max(tempC[i][j - 1], tempC[i - 1][j]);
				}
			}
			monitor.incrementProgress(1);
		}

		c = tempC;
	}
Compute the LCS
@param monitor the task monitor
Ghidra/Framework/Generic/src/main/java/generic/algorithms/Lcs.java