Solved first part of maximal element in portion of array