Solved the linear method for max subarray, resolved some bugs