Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _find(self, *sequences):
subseq = LCSStr()(*sequences)
length = len(subseq)
if length == 0:
return 0
before = [s[:s.find(subseq)] for s in sequences]
after = [s[s.find(subseq) + length:] for s in sequences]
return self._find(*before) + length + self._find(*after)
before = [s[:s.find(subseq)] for s in sequences]
after = [s[s.find(subseq) + length:] for s in sequences]
return self._find(*before) + length + self._find(*after)
def __call__(self, *sequences):
result = self.quick_answer(*sequences)
if result is not None:
return result
scount = len(sequences) # sequences count
ecount = sum(map(len, sequences)) # elements count
sequences = self._get_sequences(*sequences)
return scount * self._find(*sequences) / ecount
lcsseq = LCSSeq()
lcsstr = LCSStr()
ratcliff_obershelp = RatcliffObershelp()