Two Sum Maximization(Contest)
Two Sum Maximization easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Two Sum Maximization easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
You are given an array A of size N. For all pairs (i, j) (1 <= i < j <= N), find the maximum value of Ai + Aj in the array. Input The first line of the input contains a single integer N. The second line of the input contains N space seperated integers.
Constraints: 2 <= N <= 105 1 <= Ai <= 109 Output Print the maximum value of Ai + Aj in the array. Example Sample Input: 5 6 4 9 3 7
Sample Output: 16
link: