Compute max diff in series in O(n) time.
Fixed docs and added test case.