Leetcode Longest Common Sequence In Python