<commit_before>#
# Longest Increasing Subsequence
# A dynamic programming approach
#
# O(n^2) complexity
#

sequence = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15]

all_lis = [[sequence[0]]]
for idx, s in enumerate(sequence):
	endx = sequence[idx]
	for idy, l in enumerate(all_lis):
		endy = all_lis[idy][-1]
		if(s > endy):
			all_lis.append(all_lis[idy] + [s])

max_len = max(map(len, all_lis))
print [m for m in all_lis if len(m) == max_len]<commit_msg>refactor LIS into a class<commit_after>#
# Longest Increasing Subsequence
# A dynamic programming approach
#
# O(n^2) complexity
#

class Lis:

    def lis(self, sequence):
        all_lis = [[sequence[0]]]
        for idx, s in enumerate(sequence):
            endx = sequence[idx]
            for idy, l in enumerate(all_lis):
                endy = all_lis[idy][-1]
                if(s > endy):
                    all_lis.append(all_lis[idy] + [s])

        max_len = max(map(len, all_lis))
        return [m for m in all_lis if len(m) == max_len]
{'fraction_non_alphanumeric': 0.14047151277013753, 'fraction_numerical': 0.0275049115913556, 'mean_word_length': 2.8452830188679243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6278997', 'n_tokens_mistral': 424, 'n_tokens_neox': 372, 'n_words': 109}