get maximum sum of sub-array