Company: Natwest_7aug
Difficulty: medium
Sum of Energies for Maximum Product Problem Description In a science research lab, combining two nuclear chemicals produces a maximum energy that is the product of the energy of the two chemicals. The energy values of the chemicals can be negative or positive. The scientist wishes to calculate the sum of the energies of the two chemicals which produces maximum energy on reaction. Write an algorithm to find the sum of energy of the two chemicals which produces maximum energy on reaction. Input The first line of the input consists of an integer - numOfChem , representing the number of chemicals (N). The second line consists of N space-separated integers - ener_1, ener_2, ..., ener_N , representing the energies of the chemicals. Output Print an integer representing the sum of energy of the two chemicals which produces maximum energy on reaction. Constraints 0 -10^6 0 Examples Example 1: Input: 7 9 -3 8 -6 7 8 10 Output: 19 Explanation: The maximum product of the energies is 90, i.e. 9 * 1