problem from hired.com

Finding the maximum deviation among the sequences in an array