When i run the code in pycharm or some other compiler its is working fine but when i run code in hacker rank and hacker earth i am getting value error.
Please help me guys. The question is:
Max Pair Sum
Given a list of distinct integers A, find the largest sum of any pair of elements.
Input
6
1 2 3 89 4 10
First line contains the size of list N.
Second line contains list elements.
Output
99
Here it's my solution :
N=int(input("enter N :"))
Data=[]
for i in range(N):
Data.append(int(input()))
#print(Data)
Data.sort()
#print(Data)
max_val=max(Data)
print(max_val)
Data=Data[0:len(Data)-1]
#print(Data)
x=list(map(lambda x:x+max_val,Data))
max_val=max(x)
print(max_val)