Find the longest arithmetic progression inside a sequence
问题 Suppose I have a sequence of increasing numbers, and I want to find the length of longest arithmetic progression within the sequence. Longest arithmetic progression means an increasing sequence with common difference, such as [2, 4, 6, 8] or [3, 6, 9, 12]. For example, for [5, 10, 14, 15, 17] , [5, 10, 15] is the longest arithmetic progression, with length 3; for [10, 12, 13, 20, 22, 23, 30] , [10, 20, 30] is the longest arithmetic progression with length 3; for [7, 10, 12, 13, 15, 20, 21] ,