2) {
$arguments = \func_get_args();
\array_splice($arguments, 0, 2, [$this->solve($stringA, $stringB)]);
return $this->solve(...$arguments);
}
$charsA = \str_split($stringA);
$charsB = \str_split($stringB);
$matrix = \array_fill_keys(\array_keys($charsA), \array_fill_keys(\array_keys($charsB), 0));
$longestLength = 0;
$longestIndexes = [];
foreach ($charsA as $i => $charA) {
foreach ($charsB as $j => $charB) {
if ($charA === $charB) {
$matrix[$i][$j] = $i === 0 || $j === 0 ? 1 : $matrix[$i - 1][$j - 1] + 1;
$newIndex = $this->newIndex($matrix, $i, $j);
if ($matrix[$i][$j] > $longestLength) {
$longestLength = $matrix[$i][$j];
$longestIndexes = [$newIndex];
} elseif ($matrix[$i][$j] === $longestLength) {
$longestIndexes[] = $newIndex;
}
} else {
$matrix[$i][$j] = 0;
}
}
}
return $this->result($longestIndexes, $longestLength, $stringA);
}
/**
* @param array