kadane algo with start and end Index