max sub array problem.
the linear implementation seems wrong. check it.