*** You may only submit a given problem once - no resubmissions will be accepted. ***
An arithmetic series consists of a sequence of terms such that each term
minus its immediate predecessor gives the same result. For example,
the sequence 3,7,11,15 is the terms of the arithmetic series 3+7+11+15; each term minus its predecessor
equals 4. (Of course there is no requirement on the first term since it
has no predecessor.)
Given a collection of integers, we want to find the longest arithmetic
series that can be formed by choosing a sub-collection (possibly the entire collection).
Create a class
ASeries that contains a method longest that is given a int[] values and
returns the length of the longest arithmetic series that can be
formed from values.
|