@@ -0,0 +1,923 @@
+# Time:  O(m * n)%0A# Space: O(min(m, n))%0A%0A# Given two integer arrays A and B,%0A# return the maximum length of an subarray that appears in both arrays.%0A#%0A# Example 1:%0A# Input:%0A# A: %5B1,2,3,2,1%5D%0A# B: %5B3,2,1,4,7%5D%0A# Output: 3%0A# Explanation: %0A# The repeated subarray with maximum length is %5B3, 2, 1%5D.%0A# Note:%0A# 1 %3C= len(A), len(B) %3C= 1000%0A# 0 %3C= A%5Bi%5D, B%5Bi%5D %3C 100%0A%0Aclass Solution(object):%0A    def findLength(self, A, B):%0A        %22%22%22%0A        :type A: List%5Bint%5D%0A        :type B: List%5Bint%5D%0A        :rtype: int%0A        %22%22%22%0A        if len(A) %3E len(B): return findLength(B, A)%0A        result = 0%0A        dp = %5B%5B0%5D * (len(B)+1) for _ in xrange(2)%5D%0A        for i in xrange(len(A)):%0A            for j in xrange(len(B)):%0A                if A%5Bi%5D == B%5Bj%5D:%0A                    dp%5B(i+1)%252%5D%5Bj+1%5D = dp%5Bi%252%5D%5Bj%5D+1%0A                else:%0A                    dp%5B(i+1)%252%5D%5Bj+1%5D = 0%0A            result = max(result, max(dp%5B(i+1)%252%5D))%0A        return result%0A

Create maximum-length-of-repeated-subarray.py