Just 5 python Lines!


class Solution:

def solve(self, A):
    return A[0]+A[lastElem]


Respected @Bill1010:
its in order of nlog(n) but u can simplpy do it in ordr of n by just using min andmax which is order of O(n)only so two times O(n) thats it


one line of code
return max(A)+min(A)