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.
The first line of the input consists of an integer - numrChem, representing the number of chemicals (N). ($$$0 \le numOfChem \le 10^6$$$)
The second line consists of N space-separated integers- ener*0*, ener*1* ....... ener*N-1* representing the energies of the chemicals.($$$-10^6 \le eneri \le 10^6$$$)
Print an integer representing the sum of energy of the two chemicals which produces maximum energy on reaction
7 9 -3 8 -6 -7 8 10
Result : Successful
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.Continue to Log In
Do let us know your issue.