Question: Code in Java and in most optimise manner Consider an array containing at least 2 non - zero positive integers ranging between 1 and to
Code in Java and in most optimise manner
Consider an array containing at least nonzero positive integers ranging between and to Divide the integers in inarr into two groups based on the following rules:
Each of the integers should belong to either of the two groups
Total sum of integers in each of the groups must be nearly as equal as possible
Total number of integers between the groups should not differ by more than
print, outnum and outnum the sum of integers of two groups separated by a space. If they are not equal, the print the smaller one first and the bigger one second Sample input:
Sample output:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
