Exemplo n.º 1
0
 def test_lcs_length_one_row(self):
     X = "ABCBDAB"
     Y = "BDCABA"
     self.assertEquals(lcs_length_one_row(X, Y), 4)
     X = [1, 0, 0, 1, 0, 1, 0, 1]
     Y = [0, 1, 0, 1, 1, 0, 1, 1, 0]
     self.assertEquals(lcs_length_one_row(X, Y), 6)
     X = "ACCGGTCGAGTGCGCGGAAGCCGGCCGAA"
     Y = "GTCGTTCGGAATGCCGTTGCTCTGTAAA"
     self.assertEquals(lcs_length_one_row(X, Y), 20)
 def test_lcs_length_one_row(self):
     X = "ABCBDAB"
     Y = "BDCABA"
     self.assertEquals(lcs_length_one_row(X, Y), 4)
     X = [1, 0, 0, 1, 0, 1, 0, 1]
     Y = [0, 1, 0, 1, 1, 0, 1, 1, 0]
     self.assertEquals(lcs_length_one_row(X, Y), 6)
     X = "ACCGGTCGAGTGCGCGGAAGCCGGCCGAA"
     Y = "GTCGTTCGGAATGCCGTTGCTCTGTAAA"
     self.assertEquals(lcs_length_one_row(X, Y), 20)
Exemplo n.º 3
0
def longest_monotonically_increasing_subsequence(A):
    C = sorted(set(A))
    return lcs_length_one_row(A, C)