maximum element in array hackerrank solution