Hi everyone,

can nyone tell me an algorithm other than bruteforce for this problem ?

S contains the set of positive integers. Find the largest number c such that c = a+b, where a, b, c are distinct

numbers of the set. If no c such exists, you should print “No Output”.

Sample Input:

2

7

1 6 10 3 14 18 51

6

7 3 1 9 4 5

Sample Output:

No Output

9 4 5.

Order the set in ascending order and start at the largest number c. Search downwards

and try to find a and b such that a+b == c, if the largest possible a and b are < c

you can skipt that loop. It doesn't bring down the big-Oh value but it cant cut off

quite a bit.

kind regards,

Jos